mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
Merge pull request #6375 from LLK/hotfix/gtm
[Develop] Add configuration for GTM
This commit is contained in:
commit
372681ade1
3 changed files with 18 additions and 2 deletions
|
@ -40,7 +40,7 @@ aliases:
|
|||
- v1-build-
|
||||
- &build_no_cache
|
||||
<<: *defaults
|
||||
resource_class: medium+
|
||||
resource_class: large
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
|
|
|
@ -28,5 +28,6 @@ module.exports = {
|
|||
og_image_height: 860,
|
||||
|
||||
// Analytics & Monitoring
|
||||
ga_tracker: process.env.GA_TRACKER || ''
|
||||
ga_tracker: process.env.GA_TRACKER || '',
|
||||
gtm_id: process.env.GTM_ID || ''
|
||||
};
|
||||
|
|
|
@ -3,6 +3,16 @@
|
|||
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
|
||||
<!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]-->
|
||||
<head>
|
||||
<% if (htmlWebpackPlugin.options.gtm_id) { %>
|
||||
<!-- 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','<%- htmlWebpackPlugin.options.gtm_id %>');</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
<% } %>
|
||||
|
||||
<meta charset="UTF-8" />
|
||||
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
|
@ -55,6 +65,11 @@
|
|||
</head>
|
||||
|
||||
<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>
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
<% } %>
|
||||
<noscript>
|
||||
<p>Your browser has Javascript disabled. Please go to your browser preferences and enable Javascript in order to use Scratch.</p>
|
||||
</noscript>
|
||||
|
|
Loading…
Reference in a new issue