-
Determining Independent Client IDs for Google Analytics 3 and Google Analytics 4 on a Single Page
At the moment, I’m rocking a page with both Google Analytics 3 and Google Analytics 4, which are all setup thanks to GTM. My challenge though is getting each of their client ID separately. Got me wondering if they both clock in with independent IDs when running on the same page. Yet to get a handle on that aspect as I am not certain if this verifies it or not.
Checking out the list of trackers on the page using this code below, I get an entire object for my GA3 tracker when I use the first console.log, but the second console.log pats me on the back with an undefined. It seems to be giving GA4 the cold shoulder.
ga(function(tracker) { var trackers_multi = ga.getAll(); console.log("Trackers1: " + JSON.stringify(trackers_multi[0])); console.log("Trackers2: " + JSON.stringify(trackers_multi[1])); });
Switching lanes to cookies, if I take a dive into chrome dev tools > application > cookies, and go on a “_ga” search spree, only one _ga cookie gets thrown back at me. Now, does this make a case for them really sharing just one client ID or is there something I’m not catching?
Log in to reply.