Ardi Vaba Ardi Vaba - 5 months ago 11x
jQuery Question

Detect google ads click

I have gaming commmunity forum, where i installed some Google Ads, but people are abusing it (out of their good will ofcourse) and clicking them i don't want to generate any illegal clicks to the site, but some people just are not listening.

Is there any way to detect if someone has clicked google i could disable them for the use who has clicked them for a day or so.

Thanks for you help.


Google ads are iframes and Javascript does not have access to the contents or adding events to it if it's on a different domain then the parent site (see the law of iframes here).

You can, however, place a clear div (visibility: hidden, not display: none) over the iframe and, in a way, intercept the clicks to it. The only issue with this is that you either intercept the click or you don't. So when the user clicks the first time you can run your logic on whether to allow it or not, and if you want to allow it, display: none your div and prompt the user to click again.

This is pretty much the only way you can do it.