I am trying to make a script which detects clicks on google ads. All events works like onmouseover, out etc except click, focus, mousedown. When i click on google ads it open its ads link but dont run my jquery script on click event. I have tried preventdefault and other functions like that too.
I want to detect click on google ads and parse the iframe width and height to php file when clicked.

$(window).load(function(){
$('iframe').bind('mouseover', function(){
var iframeID = $(this).attr('id');
$(this).contents().find('html').unbind();
$(this).contents().find('html').bind('click', function(){
alert(iframeID);
});
});
});
this is the code run on mouseover but not on click event.
Member Avatar for stbuchok

try using on for binding events in jQuery

i used binding every event but in vain. please give me solution of this

anybody please help me with this, no one is answering

Member Avatar for stbuchok

maybe if you gave us a page to look at we could help.

Does the googleads api have anything to say?

the googlead is outside your page, the clicktrack is already written to report to google, so your code will have no effect
if it did, you would break the googleads TOS,

I would not want to argue an intellectual rights lawsuit against google

i get google ads by its frame id which is aswift_0. When is uses mouseover or mouseout my code work. But when i uses click event on iframe it stop working. I have already given you my code

Your code is irrelevant. An iframe is not part of your page, it is external, a complete page from doctype to /html rendered in a little box.
the code of the iframe is by google
the terms of service are by google
the API to manipulate the iframe is by google
ergo, 'does the googleads api have anything to say?'

and even if the href of the iframe is ON your server it is still external to the page that calls it, just for reference.

so you are telling me there is no way to call click event on google ads.

No,.
telling you to check the google adwords API to find how to interact with the code
google publish instructions for their systems
ergo, 'does the googleads api have anything to say?'

the google search would probably be 'google adwords api'

we can track click with google analytics and for your information statcounter can also track clicks on google ads. I want to do same thing as statcounter do on google ads

I know the answer, you do not
I know how statcounter operates
I know how google analytics operates
I am not going to do it for you,
I have instead pointed you at the source, to accomplish what you want.
You will then have the tools neccessary to make your site behave as you wish, and not have to ask the same question the next time you wish to make any alteration
the googleads api, mentioned in many prior posts, contains instructions on how to interact with adwords ads
API = Application Programming Interface

last time, : does the googleads api have anything to say ?

kmayoyo kōhai

i dont want any api, i just want to do it with javascript/jquery which parse date to php when ads clicked. I just asked a simple question to run click event on google ads with javascript/jquery but you start giving me api, api.......
I dont need api because i have to track click event on thousands of sites and api dont work there.
So tell me yes or no , that click event work on google ads or not and stop wasting my time if you dont know.....

still waiting?
nobody else is likely to try n assist,
absolute lack of common sense

google javascript apis are a collection of javascript methods
short simple scriptlets for interacting with Google scripts,
not a program,
not anything you need to install,
not anything that will not just work ANYWHERE
simple methods to do what you want.

If you really intend to implement anything Google, FFS RTFM

now kmayoyo kōhai

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.