问题描述
点击广告时,我需要识别我的用户。例如,当用户A在线时,我需要知道他是点击广告单元的人。
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.
使用我自己的广告时,这是蛋糕(使用URL重定向)-但是,现在我们计划切换到Adsense-通过javascript呈现广告-因此我无法在此处设置重定向。
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.
怎么办我会跟踪-哪个用户使用哪个广告单元-如果出现adsense?
How do I track - which user which ad unit - in case of adsense?
非常感谢。
-
Maku
--Maku
推荐答案
即使没有好的方法,也很容易做到。
首先将您的adsense代码放在div中,例如:
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>
现在在您的jquery代码中使用以下命令:
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);
});
请注意,您的php将在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.
这篇关于自定义点击跟踪的AdSense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!