I'm getting Google analytics using Google API. In order to get analytics I need to provide profile Id which looks like "ga:12345678".
The problem is that user can have many profiles. Is it possible to figure out profile Id from say Google tracking code (e.g. if I know tracking ID which looks like "UA-1234567-1")? Are they related to each other at all?
Thanks
I had the same issue and I find out the simplest way to get google analytics profile id.
Log into Google Analytics
1.Access your site’s profile (get to the dashboard)
2.Your URL should look like:
https://www.google.com/analytics/web/#report/visitors-overview/a1234b23478970p987654/
/a1234b23478970p987654/
That last part, after the “p” is your Google Analytics Profile ID, in this case (this is a fake account) it is “987654”
You can programatically get the profiles that exist for a given WebPropertyId (UA code) using the management API (link below).
The HTTP call you make will look like this:
https://www.google.com/analytics/feeds/datasources/ga/accounts/[accountID]/webproperties/[webPropertyID]/profiles
Where accountID
and webPropertyID
will either be set to the specific values you are interested in or ~all
to bring back everything the current user has access to.
If by convention you don't create multiple profiles under a Web Property then only the default profile will be returned for a given WebPropertyId, which means you will be getting a one-to-one mapping from WebPropertyId to profile id. This will allow you to look up a profile id from a WebPropertyId.
See here on the management API docs for more info: http://code.google.com/apis/analytics/docs/mgmt/mgmtFeedReference.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With