How to get Traffic source data in universal analytics?
如何在通用分析中获取流量来源数据?
I'm trying the following code in firebug console:-
我在firebug控制台中尝试以下代码: -
ga(function(tracker) {
var src = tracker.get('campaignSource');
console.log(src);
});
But it always logs 'undefined'.
但它始终记录'未定义'。
The field 'campaignMedium' also returns 'undefined'.
字段'campaignMedium'也返回'undefined'。
But I get correct values for some fields like 'clientId' or 'screenResolution' or 'language'.
但是我得到了'clientId'或'screenResolution'或'language'等字段的正确值。
Is there some other process to get these infromation?
有没有其他过程来获得这些信息?
P.S: I'm using https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#trafficsources for reference of field names.
P.S:我使用https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#trafficsources作为字段名称的参考。
2 个解决方案
#1
3
I don't believe you can because campaign info is all stored server-side. The reason you're able to get the value of the fields for 'clientId', 'screenResolution' and 'language' is that they are stored client-side.
我不相信你可以因为竞选信息全部存储在服务器端。您能够获得'clientId','screenResolution'和'language'字段值的原因是它们存储在客户端。
If you wanted to get the campaign source, etc., you'd have to create your own cookie and store the campaign values there.
如果您想获得广告系列来源等,则必须创建自己的Cookie并在其中存储广告系列值。
#2
1
As Blexy suggested, with UA it's better to rely on your own cookie for tracking traffic sources. Try this project: https://github.com/dm-guy/utm-alternative
正如Blexy建议的那样,使用UA最好依靠自己的cookie来跟踪流量来源。试试这个项目:https://github.com/dm-guy/utm-alternative
#1
3
I don't believe you can because campaign info is all stored server-side. The reason you're able to get the value of the fields for 'clientId', 'screenResolution' and 'language' is that they are stored client-side.
我不相信你可以因为竞选信息全部存储在服务器端。您能够获得'clientId','screenResolution'和'language'字段值的原因是它们存储在客户端。
If you wanted to get the campaign source, etc., you'd have to create your own cookie and store the campaign values there.
如果您想获得广告系列来源等,则必须创建自己的Cookie并在其中存储广告系列值。
#2
1
As Blexy suggested, with UA it's better to rely on your own cookie for tracking traffic sources. Try this project: https://github.com/dm-guy/utm-alternative
正如Blexy建议的那样,使用UA最好依靠自己的cookie来跟踪流量来源。试试这个项目:https://github.com/dm-guy/utm-alternative