How to Ensure GTM Snippets Remain in Codebase

If your dataLayer or GTM script is suddenly missing from your site then ensure your developers follow this process.

Here are instructions on how the GTM Suite Works, what snippets are created in your theme, and how to configure into a theme codebase so they are not deleted during deployments. 

Step 1: Download the 3 Shopify snippets 

Once you install the Google Tag Manager Suite app you will see the following snippets are created inside the theme:

  • elevar-head (this inserts GTM container code)
  • elevar-body-end (this creates the full dataLayer)
  • elevar-checkout-end (this contains GTM and dataLayer for checkout)

Step 2: Add snippets to the theme


You will now need to call these snippets in:

  • theme.liquid
  • checkout.liquid (if on Shopify Plus)


Where  is at the top of <head>


And  is just before the closing </body> tag.



(Optional) Step 4: Shopify Plus Users

The process is the same for the checkout.liquid:


Where  is at the top of <head>

And  is just before the closing </body> tag.

Step 4: Remove Pre-Existing GTM Scripts from Theme

It's possible you already have GTM scripts installed in the theme. If this is the case they will need to be removed to prevent duplicate GTM tags.