1.9K members online now
1.9K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
 
Guide Me
star_border
Reply

Exposing ClientID in Google Analytics

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi All,

 

GA uses an internal ClientID in order to identify users so that their subsequent visits can be assigned to the same user.

 

Is it possible to access this value in Google Analytics reports? It would be useful to be able to track a single users movements.

 

Thanks,

Martin

3 Expert replyverified_user
Marked as Best Answer.
Solution
Accepted by topic author Martin W
November 2015

Re: Exposing ClientID in Google Analytics

Top Contributor
# 2
Top Contributor
Hi Martin,

so far the only option would be to send it as a Custom Dimension and then use it in custom reports / secondary dimension / export. To fetch the client Id you can use https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id?hl=en#getti...

Please note it is not the user you are tracking yet the unique cookie value (if _ga) - to be more accurateSmiley Happy

Kind regards,
Zorin
Web analyst @ escapestudio.net

Re: Exposing ClientID in Google Analytics

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Zorin,

Thanks for the reply. It's a pity that I'll need to update our website pages in order to get this information into the reports, but it sounds like it'll give me the user level granularity that I'd like.

I'll see if I can get this deployed, thanks for the reply!
Martin

Re: Exposing ClientID in Google Analytics

Top Contributor
# 4
Top Contributor
Hi Martin W,

In addition to @Zorin Escape's great reply, if you happen to be using GTM, then getting this client ID is actually quite easy. Smiley Happy
Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn

Re: Exposing ClientID in Google Analytics

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Hi Nicky,

We are looking into deploying this now and we are using GTM - could you elaborate on how it can easily be done in GTM?

Thanks,
Martin

Re: Exposing ClientID in Google Analytics

[ Edited ]
Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

@Nicky Y: Did you have any source or advice to do that with GTM?

Re: Exposing ClientID in Google Analytics

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
I ended up using the method described here:

http://www.simoahava.com/analytics/improve-data-collection-with-four-custom-dimensions/#2

I think Simo has another method that I think is slightly more accurate (drops fewer hits), but this implementation was simple and works well enough for me.

Thanks,
Martin

Re: Exposing ClientID in Google Analytics

Top Contributor
# 8
Top Contributor

Hi @Moritz C,

 

One way I do this through GTM is by creating a custom HTML "Preloader" tag that loads on every page, on DOM ready. This tag is more like a utility tag that provides other functionalities on every page, like cookie setting and getting, etc. In that tag I include the standard GA snippet so that I can create a named tracker from which I retrieve the client ID and push that into a custom dimension that is available for my reports. I also create both hit- and user-level custom dimensions with this client ID so that not only is it available with the typical use case of tracking all users, but I can now also use it with every hit.

 

Code-wise, here's how that looks:

 

 

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXX-Y', 'auto', {'name': 'some_name', 'allowLinker' : 'true'}); ga(function(t) { try { t = ga.getByName('some_name'); window.dataLayer.push({ 'event' : 'preloader_completed', 'gacid' : t.get('clientId') }); }
catch (e) {
// error handling code here } });

 

 

Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn

Exposing ClientID in Google Analytics

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭

Is there no way to simply identify your client ID?

 

It seems that this would be a simple value accessible from the admin tab from within GA. Or am I completely misunderstanding what the 'cid' is.

 

I only need it to include in the GA embed markup. https://ga-dev-tools.appspot.com/embed-api/basic-dashboard/

Exposing ClientID in Google Analytics

Visitor ✭ ✭ ✭
# 10
Visitor ✭ ✭ ✭

Hi,

Why GA account show many abnormal client id ,they are looked like this:"ww.asanaglobal.com%2525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525"
Looking forward to your reply.Thanks!
Experts in the Topic
Nicky Y
John W
Zorin Escape