I want to track exit links on my website and also exit ads like Google Adsense etc. I mean by exit ads is that when click on add I get ads dimension and ads type like Google or other ads. In short I want this: Google Adsense 160x600 like in statcounter.com.

2 Answers 2



I'm trying to answer this as short as possible. Click-tracking is something you cannot do with PHP on the click itself. It is possible to have the backend do the tracking (via unique IDs, $_POST and a simple tracking script).

It is also possible to do with Javascript, if you have your own tracking solution another way would be to trigger the clicktrack through Ajax via Javascript and have a PHP-script count the clicks.

For Google Adsense ads a clicktracking solution is also possible, but it will definately break the terms and conditions, since you are not allowed to change, alter or modify anything inside or over the ads.

  • i have added more info about my problem below please tell me solution May 15, 2013 at 4:03
  • I have no idea what you are trying to do there, sorry. I don't know the content of adds.php, nor do I know how you integrate it on your page, what the javascript in your "answer" is supposed to do, nor a lot of other things necessary to provide you with a turnkey solutions. You need to either specify your question, or for programming related questions -> Stackoverflow would be the better place to ask ... ;) In short, you can't change, add or modify things in an iFrame. You need to 'overlay' the iFrame with your own content and do the click-tracking on your overlay. Like a heatmap would.
    – David K.
    May 15, 2013 at 9:12
  • script works when i change $('#aswift_0').load(function() but when i change load to click like this $('#aswift_0').click(function() it stop working May 16, 2013 at 6:40

i have made a script which works on links but not on iframe generated by google adsense. I have added click event on iframe but it is not working.

$('#aswift_0').click(function() {
    var width = $(this).attr('width');
    var height = $(this).attr('height');
    var webid = "1";
    new Image().src = "adds.php/?width=" + escape(width) +   "&height=" + escape(height) + "&webid=" + escape(webid);
    // new Image().src = "adds.php/?width=" + escape (width) + "&height=" + escape (height) + "";

It works when i change click to load

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.