Skip to content

Commit 41867ab

Browse files
committed
Fixes #49 - Add universal google analytics
We’re opting for the ‘alternative async tracking snippet’ from https://developers.google.com/analytics/devguides/collection/analyticsjs /#alternative_async_tracking_snippet. Given we’re primarily targeting modern browsers, I think it’s nicer to go for the version supporting preloading.
1 parent b578864 commit 41867ab

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

public/index-static.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,13 @@
6666
console.log('service worker is not supported');
6767
}
6868
</script>
69+
<!-- Google Analytics -->
70+
<script>
71+
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
72+
ga('create', 'UA-79730498-1', 'auto');
73+
ga('send', 'pageview');
74+
</script>
75+
<script async src='https://www.google-analytics.com/analytics.js'></script>
76+
<!-- End Google Analytics -->
6977
</body>
7078
</html>

src/views/index.ejs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,13 @@
6666
console.log('service worker is not supported');
6767
}
6868
</script>
69+
<!-- Google Analytics -->
70+
<script>
71+
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
72+
ga('create', 'UA-79730498-1', 'auto');
73+
ga('send', 'pageview');
74+
</script>
75+
<script async src='https://www.google-analytics.com/analytics.js'></script>
76+
<!-- End Google Analytics -->
6977
</body>
70-
</html>
78+
</html>

0 commit comments

Comments
 (0)