Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find segment ID in Google analytics?

I am trying to output the content of a Google Analytics segment using a script called Oochart.

To do this I need the segment ID, how do I find this?

like image 524
user18577 Avatar asked Nov 22 '12 11:11

user18577


2 Answers

There's no simple way. You either have to try to read it from the URL when you apply the segment, or select the segment in the query explorer (http://ga-dev-tools.appspot.com/explorer/) which will then show the segment ID.

like image 132
LCarey Avatar answered Oct 08 '22 09:10

LCarey


While the best answer is the one from LCarey (to use the Query Explorer: http://ga-dev-tools.appspot.com/explorer/) I found that the answer from Pavel needs update if you want to go that way instead, as the URL structure has changed.

Consider the following URL:

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

You're looking for the string "_.useg%3Duser", after which the segment ID (fSRDEURzSXe_Kspo6mxgXw) follows. To use this in API I would use gaid::fSRDEURzSXe_Kspo6mxgXw.

like image 31
John Severinson Avatar answered Oct 08 '22 11:10

John Severinson