How To Ensure Data Layer Is Not Deleted From Codebase
Learn what files are created in your store and how to check them into your version control system.
Data Layer 1.0. has been depreciated
Please follow our upgrade guide to update to our latest version.
Here are instructions on how the GTM Suite Works, what snippets are created in your theme, and how to configure them 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-head-listener (this sends data to Elevar's server-side setup)
- elevar-body-end (this creates the full dataLayer)
- elevar-checkout-end (this contains GTM and dataLayer for checkout)
Note: elevar-checkout-end.liquid file will only be there for Shopify Plus store and stores not on Shopify checkout extensibility)
If you do not have these inside your theme file, then you will have to go to your Elevar app and install the Data Layer and Data Layer Listener Sources following all the instructions.
Step 2: Add snippets to the theme code
You will now need to call these snippets in:
- theme.liquid
- checkout.liquid (if on Shopify Plus and not using Shopify Checkout Extensibility)
theme.liquid:
Where the following code is at the top of
{% render 'elevar-head-listener' %}
{% render 'elevar-head' %}
Example:

And the following code is just before the closing tag.
{% render 'elevar-body-end' %}
Example:

(Optional) Step 3: Shopify Plus Users and the stores not on Shopify Checkout Extensibility
The process is the same for the checkout.liquid template.
Where the following code is at the top of tag.
{% render 'elevar-head-listener' %}
{% render 'elevar-head' %}
And the following code will be at the top of the tag.
{% render 'elevar-checkout-end' %}
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.
Step 5: Merge the changes to your version control and production live theme
Please merge all the above-mentioned code inside your version control platform (e.g.: GitHub) and also on your production live theme to make sure that the Elevar code is not left out from the production live theme to have un-interrupted data going to your marketing destinations.
Updated 1 day ago