Expand my Community achievements bar.

Experience League LIVE: Post-session discussion - Real-Time CDP Connections

Avatar

Employee

Use this thread to ask any questions related to the Experience League LIVE session titled "Ask the experts: Real-Time CDP Connections." 

 

Experts are monitoring this thread to ensure your questions are answered. Thanks and we hope to hear from you!

1 Reply

Avatar

Employee Advisor

There was a request for the Javascript code that I'm using to set a GA Client ID. Keep in mind that I:

1. Haven't tested this with GA4 and so I don't know if a different identity format is expected. So check that if you are GA4'ing.

2. Am not a software engineer. So please don't make fun of my code 

 

OKAY. With that out of the way, here's the Javascript I'm using in a client-side Adobe Tags data element in order to set a GA Client ID. I'm then passing that into an XDM field to my Web SDK event, and letting Event Forwarding send it off to GA3:

 

if(_satellite.cookie.get('gaclientid')==undefined)
{
  _satellite.logger.log('cookie not found');
  var part1 = Math.round(Math.random()*Math.pow(10,10));
  var part2 = Date.now();
  _satellite.cookie.set('gaclientid', part1+"."+part2);
  return part1+"."+part2;
}
else {
    _satellite.logger.log('cookie found');
  return _satellite.cookie.get('gaclientid');
}