Skip to content

Commit

Permalink
move from ga to gtag
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelgautier committed Apr 4, 2021
1 parent a7a539a commit 3e23470
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion publishconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
# Following items are often useful when publishing
GITHUB_URL='https://github.com/data-show/notebooks'
TWITTER_USERNAME='DataShow_'
GOOGLE_ANALYTICS = 'UA-162035849-2'
GOOGLE_ANALYTICS = 'G-VDKS9XPQW0'
20 changes: 8 additions & 12 deletions templates/partial/ga.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
<!-- Google Analytics -->
<script type="text/javascript">
(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', '//www.google-analytics.com/analytics.js', 'ga');
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ GOOGLE_ANALYTICS }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());

ga('create', '{{ GOOGLE_ANALYTICS }}', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
gtag('config', '{{ GOOGLE_ANALYTICS }}');
</script>

0 comments on commit 3e23470

Please sign in to comment.