命令被忽略.未知目标:在Google Analytics(分析)跟踪代码中设置“自定义维度"时未定义
我正在Google Analytics(分析)跟踪代码中设置自定义维度,但是在打开Google Analytics(分析)调试器后,Chrome控制台中看到一个奇怪的错误.
I am setting up a Custom Dimension in my Google Analytics Tracking Code, however I am seeing a strange error in the Chrome Console with the Google Analytics Debugger switched on.
这是我的代码,每个页面都会触发该代码.我正在向一个区域帐户以及一个全球/汇总帐户进行报告,并且我创建了两个跟踪器来实现这一目标.
This is my code which is fired on every page. I am reporting to a regional account as well as a global/rollup account and I have created two trackers to achieve this.
<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-85521872-1', 'auto', 'crmpiccoglobal');
ga('create', 'UA-85521872-3', 'auto', 'crmpiccoregion');
ga('set', 'dimension1', 'premium');
ga('crmpiccoglobal.send', 'pageview');
ga('crmpiccoregion.send', 'pageview');
</script>
在控制台中,我看到以下内容:
In the console I see this:
运行命令:ga("set","dimension1","premium")
Running command: ga("set", "dimension1", "premium")
analytics_debug.js:10命令已忽略.未知目标:未定义
analytics_debug.js:10 Command ignored. Unknown target: undefined
我已经在我要访问其的每个属性下的GA中创建了自定义维度".
I have created the Custom Dimension in GA under each property I want to access it in.
您需要在"set"命令中使用跟踪器名称,否则GA会将命令应用于默认跟踪器t0(在您的示例中不存在) ):
You need to use your tracker names in the "set" command, else GA will apply the command to the default tracker t0 (which does not exist in your example):
ga('crmpiccoglobal.set', 'dimension1', 'premium');
ga('crmpiccoregion.set', 'dimension1', 'premium');
ga('crmpiccoglobal.send', 'pageview');
ga('crmpiccoregion.send', 'pageview');