Google analytics user explorer get user report

醉酒当歌 提交于 2020-01-02 07:42:11

问题


How do I get user report from user explorer, using GA API. Didn't manage to find any information about it here https://developers.google.com/analytics/. For instance in user explorer (audiences section) you can see a list of records having ids like 11111111111.2222222222 and I want to get information about user activity on the website for record with id 11111111111.2222222222 using GA API


回答1:


While the latest GA release notes says the client ids have been "surfaced" (i.e. made visible) it is (at least currently) not available as a dimension via the API. So if you want to use it you'd have to add the client id as a custom dimension to your reports yourself. Off the top of my hat this should look something like this:

ga(function() {
  var trackers = ga.getAll();
  trackers.forEach(function(tracker) {
    tracker.set('dimension1',tracker.get('clientId'));
  });
});

Put before the pageview this would write the client id to your custom dimension with the index 1 (which you need to create in advance via the interface in properties->custom definitions). Should also work with multiple trackers on the same page.

This will of course not help you with data that's already been collected.



来源:https://stackoverflow.com/questions/37044331/google-analytics-user-explorer-get-user-report

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