Skip to content

Commit

Permalink
theme: Update google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoZeke committed Jul 27, 2020
1 parent 303db0d commit 4acd66b
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/theme/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,13 @@

{{#if google_analytics}}
<!-- Google Analytics Tag -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-109503488-17"></script>
<script type="text/javascript">
var localAddrs = ["localhost", "127.0.0.1", ""];
// make sure we don't activate google analytics if the developer is
// inspecting the book locally...
if (localAddrs.indexOf(document.location.hostname) === -1) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{google_analytics}}', 'auto');
ga('send', 'pageview');
}
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{google_analytics}}');
</script>
{{/if}}

Expand Down

0 comments on commit 4acd66b

Please sign in to comment.