Learn business growth with Google Analytics 4 Forums Google Analytics 4 Determining Independent Client IDs for Google Analytics 3 and Google Analytics 4 on a Single Page

  • Determining Independent Client IDs for Google Analytics 3 and Google Analytics 4 on a Single Page

    Posted by Ethan on 19 November 2022 at 11:02 pm

    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?

    Samuel replied 10 months, 4 weeks ago 3 Members · 2 Replies
  • 2 Replies
  • Leo

    Member
    27 March 2023 at 3:26 am

    The user is trying to run Google Analytics 3 (GA3) and Google Analytics 4 (GA4) simultaneously on a webpage, with the aim of getting separate client IDs for both. However, he is having trouble accessing the client ID for GA4. The user thinks this may be because GA3 and GA4 are sharing the same client ID, but isn’t sure if this is the case or if they’re misunderstanding something.

  • Samuel

    Member
    22 June 2023 at 6:23 pm

    In simpler terms, what you are experiencing is because Google Analytics 4 (GA4) doesn’t use the same method for client ID tracking as Google Analytics 3 (GA3) does. While GA3 uses “_ga” cookies, GA4 provides this ID differently. Therefore, when using both on the same page, they are not sharing the same client ID, they just work in different ways.

Log in to reply.