最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Detect google ads click - Stack Overflow

programmeradmin3浏览0评论

I have gaming mmunity 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.

I have gaming mmunity 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.

Share Improve this question asked May 1, 2011 at 17:39 Ardi VabaArdi Vaba 1891 gold badge4 silver badges11 bronze badges 1
  • Best way to do it is to keep a live observation on clicks. Also check petitors that benefit from those clicks and report to google. – Muhammad Zeeshan Hussain Commented Mar 22, 2019 at 9:39
Add a ment  | 

5 Answers 5

Reset to default 5

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!

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.

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.

Here you have some official answers from Google about that:

http://adwords.blogspot..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 puters) 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.

You can use jQuery .click() event with bination 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.

发布评论

评论列表(0)

  1. 暂无评论