Enabling Data Layer on Shopify (Updated: 8 March 2023)

 



Step-01:  GTM base code to header (theme.liquid file) 


Online Store----> Themes ----> Actions ----> Edit Code ---->



Step-02: Create the dataLayer-allPages snippet ( use exact naming and casing) & copy and paste the below code


Go to Online Store ----> Themes ----> Snippets ----> Add a new snippet


Name: dataLayer-allPages


Shopify All Page Data Layer Snippet Code



Step-03: Just call dataLayer-allPages this page on header (theme.liquid file) 


Login into Shopify admin panel: 

Online Store----> Themes ----> Actions ----> Edit Code ----> Layout ----> theme.liquid (File) ----> 

> Put the Data Layer call code  directly below the opening <head> tag 



 {% include 'dataLayer-allPages' %}



Step-04: Put the bellow code on Checkout or Purchase Confirmation Page 


Go to Settings ----> Checkout ----> Order processing ----> scripts (Additional)

Code for Checkout page: Checkout Code






Page