Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can I access the unique client Id through GA API?

I am currently querying my Google Analytics data using the Google Analytics API via R.

I would like to query based on the unique client ID as my primary dimension, but I can't find this dimension using the API.

Is it possible to query Google analytics from the API using the client Id as a dimensions?

like image 714
Liz Avatar asked Mar 06 '17 10:03

Liz


People also ask

Is Google client ID unique?

In order for Google Analytics to determine that two distinct hits belong to the same user, a unique identifier, associated with that particular user, is sent with each hit via the Client ID field. The unique identifier is a randomly generated string.

How is GA client ID generated?

Google Analytics generates a unique numeric Client ID for each browser–device pair. When a user visits a site, a Google Analytics tracking code sends this ID along with session data – page address, referral source, language, etc. – to Google Analytics. The Client ID cookie exists for two years.

Can I get user level data from Google Analytics?

Using ID tracking allows you to connect these sessions and create a single view of your users in Google Analytics. You can gain access to qualitative user data to distinguish how people interact with your website, products or services.


2 Answers

Update: Client ID is now available in Google Analytics Core Reporting api as ga:clientId.

I've added it in my script and works seamlessly.

Query explorer doesn't support it yet, hopefully soon...

like image 53
testinte5tin123 Avatar answered Sep 25 '22 21:09

testinte5tin123


The only dimensions and metrics that you can use with the Google Analytics API can be found in the Dimensions and metrics explorer you could also check the metadata API.

As you can see client id is not a valid dimension exposed via the Google Analytics API. You could set this in a custom dimension yourself however for it to work your going to have to make sure that its set on every single request you send to Google Analytics.

then you can use the custom dimension metadata

update

As of late 2018 early 2019 it is now possible to query ga:clientid from the google analytics api.

like image 21
DaImTo Avatar answered Sep 22 '22 21:09

DaImTo