优化标签更改:选择与用于Google Analytics(分析)标记的变量相同的Google Analytics(分析)设置变量删除您可能具有的优化标签"触发器保存 Google Analytics(分析)标签更改:依次单击标记配置",高级设置"和标记序列".在设置标签"下,单击菜单,然后选择优化"标签.在要设置的文件"部分下,请确保配置"cookieDomain"并将其设置为自动".保存,预览和调试,并在一切正常的情况下上线Update:A/B tests are working fine.Redirect tests are running but not reporting back.I followed Google's article How to use Optimize when you deploy Google Analytics with Google Tag Manager, but I keep getting an error on Google Optimize: I used the Analytics debugger and everything seems fine, so I'm asking for your help.Here's my setup:<meta charset="utf-8"><script>dataLayer = [...]</script>//Page hiding snippet<style>.async-hide { opacity: 0 !important} </style><script>(function (a, s, y, n, c, h, i, d, e) { s.className += ' ' + y; h.start = 1 * new Date; h.end = i = function () { s.className = s.className.replace(RegExp(' ?' + y), '') }; (a[n] = a[n] || []).hide = h; setTimeout(function () { i(); h.end = null }, c); h.timeout = c;})(window, document.documentElement, 'async-hide', 'dataLayer', 4000, {'GTM-XXXXXXX': true});</script> //Optimize container id//Requiring optimize in the analytics code, but not calling a pageview<script> (function (i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); ga('create', 'UA-YYYYYYYYY-YY', {name: 'rollup', cookieName: '_rollupGa', allowLinker: true}); //Rollup analytics tracking id ga('rollup.require', 'GTM-XXXXXXX'); //Optimize container id</script>//Tag manager snippet<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-ZZZZZZ'); //Tag manager id</script>And here are my settings in Google Tag Manager:An example of such web page: TAG Heuer Men's WAZ1110.BA0875 Stainless Steel WatchAny help will be highly appreciated! 解决方案 For my setup, where I deploy Google Optimize and Google Analytics via Tag manager I had to change the following settings and it worked (including redirect tests):Optimize tag changes:Select the same Google Analytics Settings variable as the one used for Google Analytics TagRemove any trigger you might have for the Optimize TagSaveGoogle Analytics tag changes:Click Tag Configuration and then Advanced Settings and then Tag Sequencing.Under the Setup Tag, click the menu and select the Optimize tag.Under Fileds to Set section, be sure to configure 'cookieDomain' and set it to 'auto'.Save, preview and debug and go live if everything is fine 这篇关于使用跟踪代码管理器部署Analytics时运行Google Optimize会导致错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-03 19:41