Find a segment id in Google analytics?

I am trying to display the contents of a Google Analytics segment using a script called Oochart .

To do this, I need a segment identifier, how can I find it?

+4
source share
4 answers

There is no easy way. You need to either try to read it from the URL when applying the segment, or select a segment in the query explorer (http://ga-dev-tools.appspot.com/explorer/), which then displays the segment identifier.

+7
source

The Advanced Segment Feed provides a list of all standard and user-defined segments. You can get the identifier of all segments in this standalone explorer. (under the heading "Try it!"):

https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/segments/list#try-it

You need to authenticate requests using OAuth 2.0.

+1
source

As LCarey briefly mentions, you can read it at the url. I will explain this with an example.

Apply segment and see url.

Example: https://www.google.com/analytics/web/#report/visitors-overview/a27824002w53282758p54121492/%3F_.advseg%3Duser1417962107/

You are looking for the advseg option. In this case, the segment identifier is user1417962107. % 3D characters mean the equal sign "=".

In the API, you would use segment = gaid :: user1417962107

+1
source

While the best answer is the one from LCarey (for using Query Explorer: http://ga-dev-tools.appspot.com/explorer/ ), I found that the answer from Pavel is updated if you want to go like this way, instead of changing the structure of the URL.

Consider the following URL:

https://analytics.google.com/analytics/web/#report/defaultid/a23080303w45291587p45450834/%3F_.useg%3DuserfSRDEURzSXe_Kspo6mxgXw/

You are looking for the string "_.useg% 3Duser" followed by the segment identifier (fSRDEURzSXe_Kspo6mxgXw). To use this in the API, I would use gaid :: fSRDEURzSXe_Kspo6mxgXw.

+1
source

Source: https://habr.com/ru/post/1447719/


All Articles