问题描述
查看指南
我无法找到任何跟踪自定义变量的方法,如旧的跟踪jsga。 js:
_setCustomVar(index,name,value,opt_scope)
$ c $
任何人都可以提供帮助吗?
谢谢!
- 它们可以在过滤器中使用
- 它们是接口中的第一类公民,因此您将在界面中看到自定义变量名称通用自定义变量5)
- 在界面中配置
- 聚合的度量标准(自定义变量不可能)
- 20个自定义维度+ 20个自定义指标可用,而不仅仅是5个自定义变量
/度量标准,您需要在界面上配置它们。进入管理员,深入到您的网络媒体资源,然后有一个自定义定义选项卡。
然后当你跟踪它时,你只需要跟踪自定义属性的值和id例如:
ga('send','pageview',{
'dimension15':'我的自定义尺寸'
});
这会发送一个带有自定义维度的网页浏览。
您也可以在页面上设置一个适用于页面上发生的任何综合浏览量或事件的页面。
ga('set','dimension5','自定义数据');
请注意,只有设置它才会发送给GA,所以如果您决定使用 set
请确保您至少在页面上调用了 send
,以实际发送数据到GA。
更多信息:
See the Guide https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets
I cant find any way to track Custom Variables like the old tracking js "ga.js": https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingCustomVariables
_setCustomVar(index, name, value, opt_scope)
Anyone can help?
thanks!
解决方案 Custom Variables don't exist any more in analytics.js (aka Universal Analytics). It has been replace with Custom Dimensions and Metrics that are more flexible and powerful.
Advantages of Custom Metrics and dimensions:
- They can be used in filters
- They are first class citizens in the interface, so you will see the custom variable name in the interface (instead of the generic "Custom Variable 5")
- Configured in the interface
- Metrics that are aggregated (not possible with custom vars)
- 20 custom dimensions + 20 custom metrics available, instead of only 5 custom variables
In order to use Custom Dimensions/Metrics, you need to configure them on the interface. Go into admin, drill down into your web property and then there is a tab for "custom definitions".
Then when you track it, you just need to track the value and the id of the custom property eg:
ga('send', 'pageview', {
'dimension15': 'My Custom Dimension'
});
This will send a pageview with the custom dimension attached to it.
You can also set one on the page that will be applied to any pageviews or events that happened on the page.
ga('set', 'dimension5', 'custom data');
Note that only setting it won't send to GA, so if you decide to use set
make sure you call a send
afterwards at least once on the page to actually send that data to GA.
More Info: Developer Docs
这篇关于如何通过GA的新analytics.js设置自定义变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!