javascript - Getting 'Traffic Source' in universal analytics - Stack Overflow

How to get Traffic source data in universal analytics?I'm trying the following code in firebug con

How to get Traffic source data in universal analytics?

I'm trying the following code in firebug console:-

ga(function(tracker) {
  var src = tracker.get('campaignSource');
  console.log(src);
});

But it always logs 'undefined'.

The field 'campaignMedium' also returns 'undefined'.

But I get correct values for some fields like 'clientId' or 'screenResolution' or 'language'.

Is there some other process to get these infromation?

P.S: I'm using for reference of field names.

How to get Traffic source data in universal analytics?

I'm trying the following code in firebug console:-

ga(function(tracker) {
  var src = tracker.get('campaignSource');
  console.log(src);
});

But it always logs 'undefined'.

The field 'campaignMedium' also returns 'undefined'.

But I get correct values for some fields like 'clientId' or 'screenResolution' or 'language'.

Is there some other process to get these infromation?

P.S: I'm using https://developers.google./analytics/devguides/collection/analyticsjs/field-reference#trafficsources for reference of field names.

Share Improve this question asked Nov 6, 2013 at 11:38 KaushikKaushik 3,3823 gold badges24 silver badges32 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 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.

If you wanted to get the campaign source, etc., you'd have to create your own cookie and store the campaign values there.

As Blexy suggested, with UA it's better to rely on your own cookie for tracking traffic sources. Try this project: https://github./dm-guy/utm-alternative

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745162386a4614446.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信