• Resolved Heather Wilkins

    (@halounsbury)


    Hello!

    I work with an agency that works with a large number of clients. We also collaborate with several of the ad networks which rely on GA for their work. We’re trying to pick a unified way to recommend our clients add their GA tags code to their sites. We’re leaning towards Site Kit because of ease of use but we have a question about the code the plugin outputs when you add and enable both a UA and a GA4 property (separate properties not connected via the GA dashboard connections).

    We like the way Site Kit is able to add these separate tags as that’s what one of the major ad networks recommends but we prefer to use the GA4 property ID in the first script while Site Kit outputs the UA ID if you enable both that’s.

    Here’s what Site Kit does:
    https://pasteboard.co/dnb8BEOtlex0.jpg

    (Sorry, had some issues with the image block in the editor here).

    Basically, we’re wondering if there are any considerations you know of to using the UA- ID in the first script in the code. We feel like using the GA4 ID is more “future-proof” and with the upcoming sunsetting of UA, we’re wondering if/when you plan to switch the plugin coding for dual tag setups like this. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Adam Dunnage

    (@adamdunnage)

    Hello @halounsbury thanks for getting in touch with your question. Currently, this is how Site Kit places the Analytics code snippet as you have pointed out with UA first and GA4 after that.

    UA will be sunsetting this year as you have also mentioned and we are actively working on GA4 reporting for Site Kit in preparation for the sunset of UA.

    There are not any plans to change this code snippet ordering before the UA sunset but just to assure you that the team are planning for the sunset of UA and we will be accounting for this in the plugin. Is there any other questions I can help you with?

    Thread Starter Heather Wilkins

    (@halounsbury)

    Hi Adam,

    Thanks for your quick reply!

    Our concern isn’t specifically the ordering in the UA and GA4 code in the second portion of the code. Our concern is the first piece of the code.

    When you have a UA and GA4 tag both enabled through Site Kit, the beginning of the code looks like this:

    <script type='text/javascript' src='https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-1' id='google_gtagjs-js' async></script>

    It uses the UA ID in the gtag script.

    When you disable the UA tag in the plugin and with only a GA4 tag enabled in the plugin you get this:

    <script type='text/javascript' src='https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX' id='google_gtagjs-js' async></script>

    We assume that the script may keep working after UA is sunset, however, it seems like using the property’s G tag/ID there may be more futureproof?

    We may be saying the same thing basically and you may already be planning this as a part of the transition in the coming months but I wanted to make sure I was being as clear as possible.

    So, what we’d hope to see would be this:

    <script type='text/javascript' src='https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX' id='google_gtagjs-js' async></script>
    <script type='text/javascript' id='google_gtagjs-js-after'>
    window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}
    gtag('set', 'linker', {"domains":["xxxxxx.com"]} );
    gtag("js", new Date());
    gtag("set", "developer_id.dZTNiMT", true);
    gtag("config", "UA-XXXXXXXXX-1", {"anonymize_ip":true});
    gtag("config", "G-XXXXXXXXXX");
    </script>

    Thank you for your time!

    Plugin Support Adam Dunnage

    (@adamdunnage)

    @halounsbury No problem at all. I can confirm we are taking this all into consideration while preparing for the sunset of UA so there isn’t nothing to do on the users side in this instance.

    hope that helps to reassure you and please do let me know if I can help answer anymore of your questions on Site Kit.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Site Kit GA Tags Code’ is closed to new replies.