• Resolved Martin Sauter

    (@martinsauter)


    Google Site Kit places the Global Site Tag in my pages. Google Ads tells me to just add the following line to it:

    gtag(‘config’, ‘AW-XXXXXXXXX’);

    How can I achieve this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support James Osborne

    (@jamesosborne)

    @martinsauter If you’re looking to setup conversion or event tracking on your site you will need to use the Tag Manager implementation using this guide (Option 2), while then activating the Tag Manager snippet via Site Kit. Modifying the Site Kit placed Analytics snippet is not supported.

    There is also an open GitHub request in relation to event tracking which you can find below:
    https://github.com/google/site-kit-wp/issues/1207

    johpg

    (@johpg)

    Google Tag Manager is too complicated for me.

    I have Site Kit installed with Analytics connected.
    I have also manually added the Google Ads conversion code, so what I have is this:

    <script type='text/javascript' src='https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-1' 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('js', new Date());
    gtag('set', 'developer_id.dZTNiMT', true);
    gtag('config', 'UA-XXXXXXXXX-1', {"anonymize_ip":true} );
    </script>

    and then a bit further down the page I have this:

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

    Does it matter that googletagmanager is duplicated?

    Plugin Support James Osborne

    (@jamesosborne)

    @johpg Tag Manager can work with multiple tracking properties (including UA- & AW- prefix properties). While I suspect it may be more ideal if inserted into the same container Site Kit doesn’t allow for modification of the plugin placed Analytics snippet (the first example snippet you shared). The product experts at the Tag Manager Help Center should be able to better assist with this specific query.

    Note also that while you can’t modify the Site Kit placed Analytics snippet you can however implement your own tags if you feel comfortable with the below guides. Site Kit can recognize the UA- prefix manually placed snippet during setup, allowing you to view the dashboards from within the plugin.

    1. Google Supporting Documentation
    2. Google Developers Guide
    johpg

    (@johpg)

    @jamesosborne Thanks for the quick reply.
    The links you provided were helpful.

    Here’s what I’ve done:

    1. Turned OFF the option for Site Kit to add the Analytics code to the website.

    2. Edited the gtag code to include both Analytics and Ads:

    <!-- Global site tag (gtag.js) - Google Analytics: XXXXXXXXX-1 Google Ads: XXXXXXXXX-->
    <script type='text/javascript' src='https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-1' 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('js', new Date());
    gtag('set', 'developer_id.dZTNiMT', true);
    gtag('config', 'UA-XXXXXXXXX-1', {"anonymize_ip":true} );
    gtag('config', 'AW-XXXXXXXXX');
    </script>

    3. Added the code from step 2 to my site using the Insert Headers & Footers plugin.

    I’m fairly sure this is correct, so as far as I’m concerned my issue is resolved.

    Plugin Support James Osborne

    (@jamesosborne)

    @johpg Nice job, that looks great. You could also confirm correct placement with the experts at the Tag Manager Help Center.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to add gtag for Google Ads?’ is closed to new replies.