新 "gtag.js" AdWords 转化跟踪代码对现有 UA 设置的影响
Impact of new "gtag.js" AdWords conversion tracking code on existing UA setup
我收到一封来自 Google 的电子邮件,要求更改我的 AdWords 转化跟踪设置。他们要我添加新库 "gtag.js" 和对 "gtag" 函数的一些调用。
这看起来很简单。不过,在我的研究中,我读到了一些让我停下来的东西,例如
"If you have Universal Analytics code on-page and are using any sort of customization to send events, virtual pageviews or other unique data to Analytics, you will likely not want to switch to gtag.js. That would mean updating all on-page customized code to the new gtag syntax. Not sure if you have custom code? Any use of custom dimensions, custom metrics, or events is likely relying on your current implantation of Universal Analytics."
(来源:https://www.bounteous.com/insights/2018/01/30/guide-adwords-conversion-tracking-2018/)
我肯定有 Universal Analytics 调用;我不是 100% 确定他们所说的 "on-page" 是什么意思(他们会在哪里?)但我怀疑我的东西符合条件。至于 "customization," 我确实使用了编号维度(例如 ga('set', 'dimension4', creditStatusCode) )
这真的意味着我应该避免 gtag.js 吗?我不这么认为,但我也想了解 Bounteous.com post 的含义。
我的一个直觉是 post 谈论的是实际上已经制作了自己的 UA 脚本版本的网站(即修改 analytics.js- 我没有这样做)。是吗?
您可以使用全局网站代码进行 Google 广告转化跟踪,而无需在此时更改您当前的 GA 跟踪设置(尽管您希望查看更新,一旦您有机会检查需要从通用语法移植到全局站点标签的内容)。
如果您只将 gtag.js 用于 google 广告,它将类似于以下内容:
<!-- Global Site Tag (gtag.js) - Google AdWords: GOOGLE_CONVERSION_ID -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-GOOGLE_CONVERSION_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-GOOGLE_CONVERSION_ID');
</script>
如果您要结合 GA 和 Google 跟踪代码段的广告将遵循以下行
<script async src="https://www.googletagmanager.com/gtag/js?id=GA-PROPERTY_ID">
</script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA-PROPERTY_ID');
gtag('config', 'AW-GOOGLE_CONVERSION_ID');
</script>
需要在 GA 配置命令中映射自定义维度
https://developers.google.com/analytics/devguides/collection/gtagjs/custom-dims-mets
您还需要将任何事件跟踪更新为 gtag.js 语法,这同样适用于电子商务跟踪等。
有 analytics.js 到 gtag.js 迁移指南可用
https://developers.google.com/analytics/devguides/collection/gtagjs/migration
我收到一封来自 Google 的电子邮件,要求更改我的 AdWords 转化跟踪设置。他们要我添加新库 "gtag.js" 和对 "gtag" 函数的一些调用。
这看起来很简单。不过,在我的研究中,我读到了一些让我停下来的东西,例如
"If you have Universal Analytics code on-page and are using any sort of customization to send events, virtual pageviews or other unique data to Analytics, you will likely not want to switch to gtag.js. That would mean updating all on-page customized code to the new gtag syntax. Not sure if you have custom code? Any use of custom dimensions, custom metrics, or events is likely relying on your current implantation of Universal Analytics."
(来源:https://www.bounteous.com/insights/2018/01/30/guide-adwords-conversion-tracking-2018/)
我肯定有 Universal Analytics 调用;我不是 100% 确定他们所说的 "on-page" 是什么意思(他们会在哪里?)但我怀疑我的东西符合条件。至于 "customization," 我确实使用了编号维度(例如 ga('set', 'dimension4', creditStatusCode) )
这真的意味着我应该避免 gtag.js 吗?我不这么认为,但我也想了解 Bounteous.com post 的含义。
我的一个直觉是 post 谈论的是实际上已经制作了自己的 UA 脚本版本的网站(即修改 analytics.js- 我没有这样做)。是吗?
您可以使用全局网站代码进行 Google 广告转化跟踪,而无需在此时更改您当前的 GA 跟踪设置(尽管您希望查看更新,一旦您有机会检查需要从通用语法移植到全局站点标签的内容)。
如果您只将 gtag.js 用于 google 广告,它将类似于以下内容:
<!-- Global Site Tag (gtag.js) - Google AdWords: GOOGLE_CONVERSION_ID -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-GOOGLE_CONVERSION_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-GOOGLE_CONVERSION_ID');
</script>
如果您要结合 GA 和 Google 跟踪代码段的广告将遵循以下行
<script async src="https://www.googletagmanager.com/gtag/js?id=GA-PROPERTY_ID">
</script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA-PROPERTY_ID');
gtag('config', 'AW-GOOGLE_CONVERSION_ID');
</script>
需要在 GA 配置命令中映射自定义维度 https://developers.google.com/analytics/devguides/collection/gtagjs/custom-dims-mets
您还需要将任何事件跟踪更新为 gtag.js 语法,这同样适用于电子商务跟踪等。
有 analytics.js 到 gtag.js 迁移指南可用 https://developers.google.com/analytics/devguides/collection/gtagjs/migration