2
votes

We have multiple Analytics accounts accessed by a single login. We would like to get a list of custom segments that are valid for a given account. The GData API (management.segments.list) returns all segments for the user but does not include any information mapping the segments to the accounts (profiles, really).

So, if you have 10 accounts with 10 segments each, when you get the list of segments from management.segments.list V3.0 it returns 100, of which 90 will return 0 visits for any core analytics request (since requests must include a profile id).

While the documentation is normally unclear or links to a 404 URL in this case it seems complete - you just can't get a list of segments that are valid for a profile, nor see which profile a segment was created in. Anyone have any ideas?


I have an answer but couldn't post it as an answer due to my points level. Turns out all the functionality for segments and profiles is hidden in the new interface. Switching to the old interface made it visible. So segments are defined at the user level and either shown or hidden for each account / profile that the user has access to.

1

1 Answers

1
votes

I found an easy way to get custom segments details from api.

First, you need to have user management access, probably an administrator can easily do that.

Manage Segments#Set Segment availability

  • Visit this link and go to 'Set Segment availability' section in there.
  • Apply 'Collaborate permission' option as shown in the link.

After applying permission, just using your service account and Google Analytics API run the code as in below link.

Listing a User's Segments

This time you will be able to get a list of custom segments. Spent hours on it, hope it helps.