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?
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.
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.
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.
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...
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
As of late 2018 early 2019 it is now possible to query ga:clientid from the google analytics api.
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