Google Analytics multi tracking account dimension data partially not showing in report

醉酒当歌 提交于 2019-12-25 03:37:25

问题


I have two google analytics tracking account.

var ga1 = "UA-XXXXXX-1";
var ga2 = "UA-XXXXXX-2";

I then create the object and send the page view.

ga('create', ga1, 'auto');
ga('send', 'pageview');
ga('create', ga2, 'auto', {'name': 'second'});
ga('second.send', 'pageview');

I then set dimension1 in the object and send the page view again.

ga('set', 'dimension1', 'mytown');
ga('send', 'pageview');
ga('set', 'dimension1', 'mytown', {'name': 'second'});
ga('second.send', 'pageview');

And then I view the result on Google Analytics.

  1. Both ga1 and ga2 account can detect that there's a user active on the site using real time report. (e.g.: current active user = 1)
  2. But, only account ga1 can record that there's a dimension1 value received on the custom report. The custom report for the same dimension on ga2 is empty whatsoever.

Why? Is there someone can point me where my code is wrong? Thanks.

This is the combined code.

var ga1 = "UA-XXXXXX-1";
var ga2 = "UA-XXXXXX-2";

ga('create', ga1, 'auto');
ga('send', 'pageview');
ga('create', ga2, 'auto', {'name': 'second'});
ga('second.send', 'pageview');

ga('set', 'dimension1', 'mytown');
ga('send', 'pageview');
ga('set', 'dimension1', 'mytown', {'name': 'second'});
ga('second.send', 'pageview');

Thanks!


回答1:


I think the problem may be here:

ga('set', 'dimension1', 'mytown', {'name': 'second'});

When you set dimension1, you need to prefix the method with the name of the second tracker, if you are trying to set the dimension for the second tracker.

So it should be

ga('second.set', 'dimension1', 'mytown');


来源:https://stackoverflow.com/questions/29007427/google-analytics-multi-tracking-account-dimension-data-partially-not-showing-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!