Skip to content

Commit

Permalink
Visitors that have Do Not Track enabled are not tracked with Google A…
Browse files Browse the repository at this point in the history
…nalytics

Fixes point 3 in Issue PaycoinFoundation#30
  • Loading branch information
MitchellCash committed Oct 31, 2015
1 parent 0cf5ccb commit 8dc2d3b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
12 changes: 4 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -427,15 +427,11 @@ <h4>Useful sites</h4>
<!-- Custom Theme JavaScript -->
<script src="/js/grayscale.js"></script>
<script>
(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');

ga('create', 'UA-69138554-1', 'auto');
ga('send', 'pageview');

if( navigator.doNotTrack != "yes" && navigator.doNotTrack != "1" && window.doNotTrack != "1" && navigator.msDoNotTrack != "1" ){
script.src = 'js/analytics.js'
}
</script>

</body>

</html>
7 changes: 7 additions & 0 deletions js/analytics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(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');

ga('create', 'UA-69138554-1', 'auto');
ga('send', 'pageview');

0 comments on commit 8dc2d3b

Please sign in to comment.