首次使用GA和GTM。我有一个wordpress
网站,其中一个页面(外部公司的预订系统)中有一个跨域iFrame。
父页面包含以下内容:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-CODE"></script>
<script> window.dataLayer = window.dataLayer || []; function gtag(){
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-CODE');
</script>
<!-- Google Tag Manager -->
<script>
(function(w,d,s,l,i){
w[l]=w[l]||[];
w[l].push({
'gtm.start': new Date().getTime(),event:'gtm.js'
});
var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),
dl=l!='dataLayer'?'&l='+l:'';
j.async=true;
j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-CODE');
</script>
<!-- End Google Tag Manager -->
iFrame页面包含:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-CODE"></script>
<script> window.dataLayer = window.dataLayer || []; function gtag(){
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-CODE');
</script>
<!-- Google Tag Manager -->
<script>
(function(w,d,s,l,i){
w[l]=w[l]||[];
w[l].push({
'gtm.start': new Date().getTime(),event:'gtm.js'
});
var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),
dl=l!='dataLayer'?'&l='+l:'';
j.async=true;
j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-CODE', { 'send_page_view': false });
</script>
<!-- End Google Tag Manager -->
唯一的区别在于iFrame,GA代码包含以下内容:
gtag('config', 'UA-CODE', { 'send_page_view': false })
但是仍然在Google Analytics(分析)实时概述中,当我访问父页面时,我获得2倍的用户和2次页面浏览。
我错过了什么?谢谢!