Google Analytics - How to get client_id (Anonymous Client ID) sent using measurement protocol

we process requests like this on Google Analytics Measurement Protocol to track user experience. It is important for us to associate the interaction with a specific user so that we can happily set the "cid" attribute of the protocol.

my problem is that I cannot find this customer id anywhere in google analytics reports. Even when setting up reports, I cannot find a Dimension that allows me to display this information.

http://www.google-analytics.com/collect?
 v=1             // Version.
 &tid=UA-XXXX-Y  // Tracking ID / Property ID.
 &cid=555        // Anonymous Client ID.

 &t=event        // Event hit type
 &ec=video       // Event Category. Required.
 &ea=play        // Event Action. Required.
 &cm18=8000
 &cd6=crocodile

      

Do you have any idea how the cid can be found there?

+3


source to share


1 answer


A customer ID is assigned to a user (customer) while browsing your site using Google Analytics. Here is an example of how you can get the client ID if you are using jQuery.



$(document).ready(function() {
  setGaClientId();
});

var setGaClientId = function(){
  if(typeof(ga) != 'undefined'){
    ga(function(tracker) {
      console.log(tracker.get('clientId')); //actually do something here
    });
  }
}

      

0


source







All Articles