Skip to content

Commit

Permalink
chore: Update analytics providers (#27)
Browse files Browse the repository at this point in the history
Added Google in the list of providers for analytics
  • Loading branch information
David Elisma committed Jun 7, 2021
1 parent 5c28bc2 commit cd26c8e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
6 changes: 3 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

# Site settings
analytics:
provider: adobe
adobe:
tracking_id: caacec67651710193d2331efef325107c23a0145/satelliteLib-c2082deaf69c358c641c5eb20f94b615dd606662
provider: google
google:
tracking_id: UA-105628416-1
author:
en: Digital Transformation Office
fr: Bureau de la transformation numérique
Expand Down
9 changes: 9 additions & 0 deletions _includes/providers/google-gtag.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.analytics.google.tracking_id }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', '{{ site.analytics.google.tracking_id }}', { 'anonymize_ip': {{ site.analytics.google.anonymize_ip | default: false }}});
</script>
7 changes: 7 additions & 0 deletions _includes/providers/google-universal.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script>
window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
ga('create','{{ site.analytics.google.tracking_id }}','auto');
ga('set', 'anonymizeIp', {{ site.analytics.google.anonymize_ip | default: false }});
ga('send','pageview')
</script>
<script src="https://www.google-analytics.com/analytics.js" async></script>
14 changes: 14 additions & 0 deletions _includes/providers/google.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ site.analytics.google.tracking_id }}']);
{% if site.analytics.google.anonymize_ip == true %}
_gaq.push(['_gat._anonymizeIp']);
{% endif %}
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

0 comments on commit cd26c8e

Please sign in to comment.