Google Tag Manager Installation

How to validate your theme by putting the Google Tag Manager Codes in the correct section.
Written by Jonathan Diaz
Updated 2 years ago

You need to go to the coding section, in order to do that, please go from the backend of Shopify -> Themes -> Customize -> Edit Code: http://prntscr.com/ruha4z  then navigate to: Layout -> theme.liquid: 

FIRST, please make sure to copy the whole code given by the Google Tag Manager and paste it.

 

 

SECOND, please make sure to copy the whole code given by the Google Tag Manager and paste it below the <body> as per the screenshot.

 

 

NOTE: DO NOT USE the code below, it's just for example purposes, please attach your own code.

< ------------------------------------------------------------------------------------ >

Paste the code below the <head> of the theme.liquid page.

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-P2SC5JL');</script>
<!-- End Google Tag Manager -->

Additionally, paste this code immediately after the opening <body> tag:

<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-P2SC5JL"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

Did this answer your question?