Ardi Vaba
Ardi Vaba

Reputation: 189

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 constantly...now 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 ads...so i could disable them for the use who has clicked them for a day or so.

Thanks for you help.

Upvotes: 7

Views: 9468

Answers (5)

Krishan Kumar Mourya
Krishan Kumar Mourya

Reputation: 2306

You can use iframetracker plugin.

<script src="jquery.min.js"></script>
<script src="jquery.iframetracker.js"></script>

$('iframe').iframeTracker({
  blurCallback: function(){
      // Do something when clicked on ad
  }
});

for more info and demo check here.

Upvotes: 3

Heroselohim
Heroselohim

Reputation: 1291

Here you have some official answers from Google about that:

http://adwords.blogspot.com.ar/2006/03/about-invalid-clicks.html

It's not so hard to detect duplicated IPs and they could also use cookies to track users. Unless using a lot of proxies (fake computers) to do an intentional work of fraud, you should not have any problem with that.

Live that work to Adsense, they have multiple sources of data to detect that. If you have google analytics installed you also give them enough information to discard tricks.

Upvotes: 0

Mikhail
Mikhail

Reputation: 9007

If I recall correctly - it's against Google Ads rules for you to track ad clicks, because it leads to providing incentives for clicking the ads. (such as disabling them). I realize you're trying to fix the illegal clicks issue, but you're in fact digging your own grave.

But to answer your question with purely web-dev interest - you can detect the mouse X Y position (+ page scroll offset) in window.onbeforeunload and quickly ping your server. Usually this is done by creating a new Image(); with the source being a php file.

This is accurate for all browsers, regardless of iframe usage.

Good Luck!

Upvotes: 5

Mauvis Ledford
Mauvis Ledford

Reputation: 42374

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.

Upvotes: 3

Damb
Damb

Reputation: 14610

You can use jQuery .click() event with combination of some storage (cookie or database). Then you just find element containing ads, attach that click event on it and do your business logic (check if user has already clicked that before) inside. You can also manipulate how will the click progress to ads (if it gets registered or not) of course.

Upvotes: -1

Related Questions