Skip to content

Commit 198c2e0

Browse files
authored
chore: add google tag manager code on live demo (#219)
1 parent 82b6c28 commit 198c2e0

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

public/index.ejs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,5 +493,16 @@
493493
</footer>
494494

495495
<script src="https://polyfill.io/v3/polyfill.min.js?features=default,Array.prototype.find,Array.prototype.includes,Promise,Object.assign,Object.entries,Object.values,IntersectionObserver"></script>
496+
<% if (netlify) { %>
497+
<!-- Global site tag (gtag.js) - Google Analytics -->
498+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-32446386-48"></script>
499+
<script>
500+
window.dataLayer = window.dataLayer || [];
501+
function gtag(){dataLayer.push(arguments);}
502+
gtag('js', new Date());
503+
504+
gtag('config', 'UA-32446386-48');
505+
</script>
506+
<% } %>
496507
</body>
497508
</html>

webpack/plugins/files.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default [
2222
template: 'public/index.ejs',
2323
templateParameters: {
2424
appId: config.appId,
25+
netlify: process.env.NETLIFY || false,
2526
},
2627
}),
2728
];

0 commit comments

Comments
 (0)