How to Setup Both Universal Analytics & GA4 Properties

Поделиться
HTML-код
  • Опубликовано: 17 окт 2024

Комментарии • 5

  • @haleyj4719
    @haleyj4719 2 года назад +1

    So you can have two separate google analytics script codes? I thought you had to combine them.

    • @ShafiqKhan
      @ShafiqKhan 2 года назад

      I thought the same too.

    • @stephentracy
      @stephentracy  2 года назад

      Hi Haley, my apologies for the slow reply. So it is technically possible to have 2 separate tags, one for UA and GA4. However it's not really necessary to drop in 2 separate code snippets.
      There are actually many different ways to dual tag your site.
      If you are starting with a brand new web property, you simply create a GA4 property, then under the "Property Setup" page click on "Show advanced options", then you can toggle "Create a Universal Analytics property". This will automatically create a single code snippet that includes both the GA4 and UA property ID.
      On the other hand, if you have an existing website with UA tags, there are a number of ways to add in the GA4 tag, from upgrading your UA tag within the GA admin to adding a new config directive. See sample code below for the latter:
      ">
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', '');
      gtag('config', 'G-XXXXXXXX');

  • @abhishekjain905
    @abhishekjain905 2 года назад

    Tell me if I have created GA4 first, then there is option to create universal analytics or not.

    • @stephentracy
      @stephentracy  2 года назад

      Yes, you can start with a GA4 property, and create a UA tag at the same time. To do this, when you go to create a new property (using GA4), under the "Property Setup" page click on "Show advanced options", then you can toggle "Create a Universal Analytics property". This will automatically create a single code snippet that includes both the GA4 and UA property ID.