我使用经典(同步)方式使用Google AdSense广告已有4年时间。 我已将我的3个网站(Google Analytics(分析)属性)与此AdSense帐户相关联,以便在Google Analytics中提供统计信息。 一切都运作良好。
现在,我愿意切换到AdSense代码的异步版本,以加快速度优化的原因。 这部分很简单:我只需要从我的Google AdSense帐户中获取新代码。
根据我的问题,我正在使用 EACH 同步(经典)广告代码中的以下小Javascript代码段:此片段仍然需要吗? 此代码段实际上需要使用经典代码,以确保Google Analytics可以获取每个广告块的统计信息 。
<script>
//Required because each adsense code nulls 'window.google_analytics_uacct'
window.google_analytics_uacct="UA-0000000-0";
//Required because I'm using ._setDomainName in the Google Analytics code
google_analytics_domain_name="www.example.com";
//Here is the classic (synchronous) AdSense code
google_ad_client = "ca-pub-0000000000000000";
google_ad_slot = "0000000000";
google_ad_width = 336;
google_ad_height = 280;
</script>
<script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>
我即将使用AdSense中的以下异步代码,并想知道我是否仍需要包含我的代码段,或者我现在可以摆脱它?
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:inline-block;width:336px;height:280px"
data-ad-client="ca-pub-0000000000000000"
data-ad-slot="0000000000"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
答案 0 :(得分:0)
根据我的亲身经历,这是我自己的问题的答案。
两个星期前,我已从SYNCRHONOUS切换到ASYNCRHONOUS Google AdSense代码。
看来以下两行不再需要,即可将AdSense收入报告到Google Analytics(分析)。在这两行中,我的收入在Google Analytics(分析)中有很好的报道。
希望有帮助!
window.google_analytics_uacct="UA-0000000-0";
google_analytics_domain_name="www.example.com";