I need to identify my users when an ad is clicked. For example, when user A is online, I need to know that he was the one who clicked the ad unit.
When using my own ads, this was a piece of cake (using URL redirection) - however, now we are planning to switch to Adsense - which renders the Ad via javascript - hence I cannot setup a redirection there.
How do I track - which user which ad unit - in case of adsense?
Thanks alot.
--
Maku
Even though there is no good way but it is quite easy to do so.
First of all put your adsense code in a div like:
<div id="adsDiv" class="adsDiv">
<!--here your adsense code-->
</div>
now in your jquery code use this:
$(".adsDiv").on("click", function(){
setTimeout(function() {
//here call to php function via ajax etc and in php you can easily check which user is currently online via session who clicked on ad.
}, 5000);
});
note your php will function called after 5000 ms which means user has clicked and viewed your ad. you can increase or decrease it as per your need.
This should help - http://blog.openx.org/01/google-adsense-click-tracking-integration/