mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-12-17 19:12:40 -05:00
Merge pull request #7642 from cwillisf/enable-gtm-environments
build: enable GTM environments feature
This commit is contained in:
commit
f2de55b5ff
2 changed files with 22 additions and 4 deletions
|
@ -28,6 +28,23 @@ module.exports = {
|
|||
og_image_height: 860,
|
||||
|
||||
// Analytics & Monitoring
|
||||
// ----------------------
|
||||
|
||||
// GA4 Measurement ID
|
||||
// Looks like 'G-XXXXXXXX'
|
||||
ga4_id: process.env.GA4_ID || '',
|
||||
|
||||
// Universal Analytics Property ID
|
||||
// Looks like 'UA-99999999-9'
|
||||
ga_tracker: process.env.GA_TRACKER || '',
|
||||
gtm_id: process.env.GTM_ID || ''
|
||||
|
||||
// Google Tag Manager ID
|
||||
// Looks like 'GTM-XXXXXXX'
|
||||
gtm_id: process.env.GTM_ID || '',
|
||||
|
||||
// Google Tag Manager env & auth info for alterative GTM environments
|
||||
// Looks like '>m_auth=0123456789abcdefghijklm>m_preview=env-00>m_cookies_win=x'
|
||||
// Taken from the middle of: GTM -> Admin -> Environments -> (environment) -> Get Snippet
|
||||
// Blank for production
|
||||
gtm_env_auth: process.env.GTM_ENV_AUTH || ''
|
||||
};
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
<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','<%- htmlWebpackPlugin.options.gtm_id %>');</script>
|
||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl+'<%- htmlWebpackPlugin.options.gtm_env_auth %>';
|
||||
f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','<%- htmlWebpackPlugin.options.gtm_id %>');
|
||||
</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
<% } %>
|
||||
|
||||
|
@ -67,7 +68,7 @@
|
|||
<body>
|
||||
<% if (htmlWebpackPlugin.options.gtm_id) { %>
|
||||
<!-- Google Tag Manager (noscript) -->
|
||||
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=<%- htmlWebpackPlugin.options.gtm_id %>" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=<%- htmlWebpackPlugin.options.gtm_id %><%- htmlWebpackPlugin.options.gtm_env_auth %>" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
<% } %>
|
||||
<noscript>
|
||||
|
|
Loading…
Reference in a new issue