Google analytics update (#31)
* Update Google Analytics tracking code Previous template was using ga.js which is considered legacy now. The recommended way to enable Google Analytics now is via gtag.js: https://support.google.com/analytics/answer/1008080 * Do not store IP address (personally identifyable information) With GDPR in effect IP addresses are considered personally identifyable information, and storing them becomes legally complicated. Anonymizing IPs seems to be a sensible default behavior. The only drawback is slightly reduced geolocation accuracy. More information: - https://developers.google.com/analytics/devguides/collection/gtagjs/ip-anonymization - https://support.google.com/analytics/answer/2763052 - https://www.blastam.com/blog/5-actionable-steps-gdpr-compliance-google-analytics
This commit is contained in:
parent
1e0a56e0d8
commit
e6ccaf33d2
1 changed files with 7 additions and 9 deletions
|
@ -1,13 +1,11 @@
|
|||
{% if GOOGLE_ANALYTICS %}
|
||||
<script type="text/javascript">
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', '{{GOOGLE_ANALYTICS}}']);
|
||||
_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);
|
||||
})();
|
||||
<!-- 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());
|
||||
gtag('config', '{{GOOGLE_ANALYTICS}}', { 'anonymize_ip': true });
|
||||
</script>
|
||||
{% endif %}
|
||||
{% if GAUGES %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue