如何从 Google Analytics 中的异步代码跟踪 Google AdSense 统计信息?

How to track Google AdSense statistics from Asyncrhonous code in Google Analytics?

我以 经典(同步) 方式使用 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>

根据我的个人经验,这是我自己的问题的答案。

我在 2 周前从 SYNCRHONOUS 切换到 ASYNCRHONOUS Google AdSense 代码。

看来 以下两行不再需要将 AdSense 收入报告到 Google Analytics 中。没有这两行,我的收入在 Google Analytics 中得到很好的报告。

希望对您有所帮助!

window.google_analytics_uacct="UA-0000000-0";
google_analytics_domain_name="www.example.com";