{"id":4159,"date":"2020-05-13T15:59:03","date_gmt":"2020-05-13T15:59:03","guid":{"rendered":"https:\/\/trackingchef.com\/?p=4159"},"modified":"2022-09-04T17:30:41","modified_gmt":"2022-09-04T14:30:41","slug":"adding-google-tag-manager-to-your-site","status":"publish","type":"post","link":"https:\/\/trackingchef.com\/google-tag-manager\/adding-google-tag-manager-to-your-site\/","title":{"rendered":"Adding Google Tag Manager to your site"},"content":{"rendered":"\n

There are multiple ways in which you can add the Google Tag Manager (GTM) code to your site.<\/p>\n\n\n\n

Standard CMS<\/h2>\n\n\n\n

About half of the Top 1M websites use a CMS (Content Management System) of some sort (BuiltWith<\/a>), such as WordPress, Wix, Shopify etc.<\/p>\n\n\n\n

Since Google Tag Manager is the most widely adopted tag management solution (3<\/a>6<\/a>% of Top 1M<\/a>), almost every modern CMS has either a built in feature for GTM or multiple plugins to support the standard GTM implementation.<\/p>\n\n\n\n

If you have a standard implementation, you should probably stick to this solution. I’ve added a quick walk through of the most popular platforms: WordPress, Wix & Shopify.<\/p>\n\n\n\n

WordPress<\/h3>\n\n\n\n

If you’re using WordPress, the world’s most popular CMS, you have several available plugins for adding GTM to your site.<\/p>\n\n\n\n

Google Tag Manager for WordPress (GTM4WP)<\/a><\/strong> (Free)<\/p>\n\n\n\n

While there are many plugins for GTM, this plugin, developed by Thomas Geiger, is my personal favorite. Besides adding the GTM code to the site, it also offers multiple neat features such as built Woocommerce integration (for Enhanced Ecommerce tracking) and scroll, video and post meta data tracking.<\/p>\n\n\n

\n
\"image-7346790\"
Source: Google Tag Manager for WordPress Plugin homepage (gtm4wp.com)<\/a><\/figcaption><\/figure><\/div>\n\n\n

To setup the plugin, simply grab your GTM Container ID from your GTM account (learn how<\/a>).<\/p>\n\n\n\n

Wix<\/h3>\n\n\n\n

If you’re using Wix, then you can only add Google Tag Manager to sites with a connected domain (paid plan).<\/p>\n\n\n\n

  1. To connect GTM to a Wix site, you will need to first grab your GTM Container ID (learn how<\/a>)<\/li>
  2. In Wix, navigate to Marketing Integrations<\/a><\/li>
  3. Go to Google Tag Manager and click Connect<\/li>
  4. Click “Connect Google Tag Manager”<\/li>
  5. Paste in your GTM Container ID<\/li>
  6. Click Save<\/li><\/ol>\n\n\n\n
    \"\"
    Connecting Google Tag Manager to Wix<\/figcaption><\/figure>\n\n\n\n

    This will add the GTM code to all pages on your site.<\/p>\n\n\n\n

    Shopify<\/h3>\n\n\n\n

    Shopify store owners can add Google Tag Manager tracking on any plan. I must note that this is a non-standard implementation that works nonetheless.<\/p>\n\n\n\n

    To connect GTM to a Shopify store, you will need to first grab your GA Container code (learn how<\/a>). Grab only the first part of the snippet, without the opening and closing <script> tags (highlighted in the image).<\/p>\n\n\n

    \n
    \"\"
    Getting the container installation code<\/figcaption><\/figure><\/div>\n\n\n
    1. Log into your Shopify admin<\/li>
    2. Navigate to Online store > Preferences<\/li>
    3. In the Google Analytics section, assuming you already set up your Google Analytics account (learn how<\/a>), click “Add custom Javascript”<\/li>
    4. Paste the code copied from GTM<\/li>
    5. Click Save<\/li><\/ol>\n\n\n\n
      \"\"
      Adding the GTM container code in Shopify<\/figcaption><\/figure>\n\n\n\n

      Code Installation<\/h2>\n\n\n\n

      If you’re building a custom website, or just need a more flexible implementation of Google Tag Manager, you can simply install it using the provided Javascript snippet (where do I find this?<\/a>).<\/p>\n\n\n\n

      \"\"
      Google Tag Manger installation code<\/figcaption><\/figure>\n\n\n\n

      To properly install GTM, add the JS snippet on all pages of your website, preferably as high up as possible on the <head> tag. Adding GTM code in a the <body> tag will also work, but might result in significant discrepancies in tracking. This is due to the fact that only once the GTM snippet has fully loaded are all its nested tags starting to fire, so users might already leave the page before that happens.<\/p>\n\n\n\n

      The bottom code snippet, of the type <noscript> is used as a fallback for browsers that do not support Javascript, and should be added to the <body> section of all pages.<\/p>\n\n\n\n

      I personally find no use in adding the <noscript> snippet as users who don’t have JS for GTM won’t have it either for other JS dependent platforms (e.g. Google Analytics)<\/p><\/blockquote>\n\n\n\n

      \n

      There I said it@googletagmanage<\/a> pic.twitter.com\/Iva6SbykYX<\/a><\/p>— Elad Levy (@mrlevyelad) May 13, 2020<\/a><\/blockquote>