Google Tag Manager
45-60 minAdvanced
Install GTM to manage all marketing tags without theme code changes.
Prerequisites
- GTM account and container
- Access to BigCommerce Script Manager
Beginner
Script Manager Installation
Add GTM via Script Manager.
1
Add Head Script
1
Go to Storefront > Script Manager
2
Create new script: Name 'GTM Head'
3
Location: Head, Pages: All Pages
4
Paste GTM head snippet
Example
<!-- 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-XXXXXXX');</script>
<!-- End Google Tag Manager -->2
Add Body Script
1
Create another script: Name 'GTM Body'
2
Location: Footer (or use theme for true body top)
3
Pages: All Pages
4
Paste GTM noscript fallback
Example
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->Verification Checklist
Pro Tips
- Use GTM environments for staging testing
- Keep container organized with folders
- Test thoroughly before publishing