Custom click tracking for adsense

老子叫甜甜 提交于 2019-12-11 00:31:12

问题


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


回答1:


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.




回答2:


This should help - http://blog.openx.org/01/google-adsense-click-tracking-integration/



来源:https://stackoverflow.com/questions/1866332/custom-click-tracking-for-adsense

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!