Search code examples
google-analytics-4

Switch from Google Universal Analytics to GA4


As per google we need to use this snippet to migrate to GA4 from UA.

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXX-Y"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-XXXXX-Y');         // Universal Analytics property.
  gtag('config', 'TAG_ID');  // Google Analytics 4 property.
</script>

I have used this script and it works fine till now.

My question is, will having UA-XXXXX tag in above (src) url still keep GA4 working after 1st July when UA expires?
I want my GA4 Tag to continue to work.


Solution

  • Will having the UA-XXXXX tag in the above (src) url keep GA4 working after 1st July when UA expires?

    Yes, It will work and will not impact your GA4.


    Will UA collect the data after July 1st, 2023?

    • UA free will stop processing the data after July 1, 2023
    • GA Premium (360) will stop processing the data after July 1, 2024

    Bit more detail on this

    The id=UA-XXXXX-Y part in googletagmanager.com/gtag/js?id=UA-XXXXX-Y is an optional param.

    The main gtag js library is googletagmanager.com/gtag/js and it is global for all Google Products.