1
0
mirror of https://github.com/kremalicious/blog.git synced 2025-02-14 21:10:25 +01:00

honor Do Not Track when setting up google analytics

This commit is contained in:
Matthias Kretschmann 2015-11-27 23:47:51 +01:00
parent ff7bba4dad
commit 4b75b96cb5

View File

@ -17,8 +17,9 @@
{% endif %} {% endif %}
<script> <script>
(function(window) { (function(window, dnt) {
if (dnt !== "yes" && dnt !== "1") {
// Google Analytics async snippet // Google Analytics async snippet
// http://goo.gl/3FPNDx // http://goo.gl/3FPNDx
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)}; window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};
@ -40,6 +41,7 @@
// Send initial pageview // Send initial pageview
ga('send', 'pageview'); ga('send', 'pageview');
}
// Track uncaught errors // Track uncaught errors
window.onerror = function(message, url, line, col) { window.onerror = function(message, url, line, col) {
@ -52,7 +54,7 @@
}); });
}; };
}(window)); }(window, navigator.doNotTrack || navigator.msDoNotTrack || null));
</script> </script>
{% if jekyll.environment == "production" %} {% if jekyll.environment == "production" %}