Analytics
4.6K members online now
4.6K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Leveraging CID to tie Events to Sessions/Visitors

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi, I'm working on a project where we're attempting to link offline events that begin as online visits to those specific online sessions that started the offline events.  We're using the 

ga(function(tracker) {
var clientId = tracker.get('clientId');
});

code to acquire the CID, but usually it's showing up in the x.y format, e.g. 

714937391.1406537193

I've read in an old (2+ years old) Groups post the following:

"UUID v4 [for example, ^[0-9]{10}\.[0-9]{10}$] is the recommended format, but that the old X.Y format of 32-bit unique random numbers is also supported, and it's possible to use either...the old X.Y format is also supported as this will eventually allow us to migrate sites that use ga.js to use analytics.js and maintain the same anonymous visitor id." 

 

My questions:

Is this still true today, 2016-01?   Are both formats still valid?  

Why would we continue to capture the old format from a site that is coded/tracked with analytics.js?  

If the X.Y format is still valid, when passing the CID into GA using the measurement protocol, do we pass the complete X.Y string including the time stamp or just the CID if our goal is to tie into a user's actual session?

 

Re: Leveraging CID to tie Events to Sessions/Visitors

A T
Participant ✭ ✭ ✭
# 2
A T
Participant ✭ ✭ ✭
Hi,

for format details: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters?hl=en#cid

Best Regards,
GA Guru.

'Star' or 'Accept as Solution' if it helped.

Re: Leveraging CID to tie Events to Sessions/Visitors

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Ben, I'm trying to do exactly the same. Have you already tried to pass the x.y as cid (sa now docs says cid "should be" a UUID)?

Re: Leveraging CID to tie Events to Sessions/Visitors

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭
We've read over this page numerous times, and it just doesn't contain enough clarity or real examples to answer the questions I've posed. That's why I came to this forum.
Thanks anyway though.

Re: Leveraging CID to tie Events to Sessions/Visitors

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Hi Pietro, we've been using the below code to capture the CID generated by analytics.js
ga(function(tracker) {
var clientId = tracker.get('clientId');
});
You could compare what you get with the javascript function with what you get for the same session in the _ga cookie. The CID may populate either as the hyphen separated value or as x.y. Then we can pass the x.y or other formatted CID, and it ought to tie into the site visitor's actual session. But when the CID is not available, then another UUID must be passed. You'll have to generate this other UUID on your end.
I believe you'll also want to configure aip= , uip= and ua= (anonymize IP, IP override and user agent override).
After a few tweaks, the changes are in queue for QA and testing...we'll see what we get.
Originally we weren't getting what we expected, but we may have found a simple bug.

Re: Leveraging CID to tie Events to Sessions/Visitors

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭
Ben, I also managed to get the cid clientside and I pass it to the server when the user fill a form. Now offline another step in the funnel could happen and if so I'd like to post a hit via measurement protocol and here I plan to use the cid the client have passed to the server (maybe days earlier). The point as you know is that clientside cid is often x.y while measurement protocol cid "should be" UUID. I wonder if this is going to work (still have to try) but even more if this could be a reliable, supported and "official" way to proceed.

Re: Leveraging CID to tie Events to Sessions/Visitors

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
I can confirm it works: passing x.y as cid in measurement protocol attach the hit to the right session. Hope this is the correct and official way to do this.

Re: Leveraging CID to tie Events to Sessions/Visitors

[ Edited ]
Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭

Hi Pietro, I'm not sure if you were able to completely tie or 'stitch' the offline event to a real online session with just the protocol details and the x.y CID, but after a lot of testing and research, we were able to do it with the x.y CID format PLUS some additional parameters.
Here's a link with documentation to help with that:
https://www.npmjs.com/package/universal-analytics