Last active
July 5, 2017 22:59
-
-
Save samba/0bf5fe5d56ef03489101 to your computer and use it in GitHub Desktop.
GTM Container Snippet for HubSpot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Google Tag Manager loader; customized by Analytics Pros [analyticspros.com] --> | |
<script> | |
/* Update these for your GTM container(s); be sure they're unique, occurring only once each, not duplicated */ | |
var GTMContainerIDs = ['GTM-XXXXX', 'GTM-YYYYY' ]; | |
window.dataLayer = window.dataLayer || []; | |
window.dataLayer.push({ | |
'platform': 'hubspot' // Update this value to reflect other platforms | |
}); | |
(function(w,d,s,l,i,j,f,dl,k,q){ | |
w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'}); | |
f=d.getElementsByTagName(s)[0], k=i.length;q='//www.googletagmanager.com/gtm.js?id=@&l='+(l||'dataLayer'); | |
while(k--){j=d.createElement(s);j.async=!0;j.src=q.replace('@',i[k]);f.parentNode.insertBefore(j,f);} | |
}(window,document,'script','dataLayer',GTMContainerIDs)); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment