From 62fcc2429fe01f81937d06ddfd513766542f4e78 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 26 Oct 2017 11:11:05 +0100 Subject: [PATCH] Standardise Google Analytics tracking across GaaP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are the settings that our analytics person has said we should be using across all the GaaP products. This commit also makes sure our tracking code is identical across all the templates that have it in (including the obsfucation of UUIDs). We may want to remove the ID obsfucation later on, but for now let’s make sure it’s happening consistently in all the places. --- app/assets/error_pages/413.html | 7 +++++++ app/assets/error_pages/5xx.html | 7 +++++++ app/templates/admin_template.html | 3 +++ 3 files changed, 17 insertions(+) diff --git a/app/assets/error_pages/413.html b/app/assets/error_pages/413.html index 632375cdb..8998ef326 100644 --- a/app/assets/error_pages/413.html +++ b/app/assets/error_pages/413.html @@ -134,6 +134,13 @@ 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-75215134-1', 'auto'); + ga('set', 'anonymizeIp', true); + ga('set', 'displayFeaturesTask', null); + ga('set', 'transport', 'beacon'); + // strip UUIDs + page = (window.location.pathname + window.location.search).replace( + /[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}/g, '…' + ) ga('send', 'pageview'); diff --git a/app/assets/error_pages/5xx.html b/app/assets/error_pages/5xx.html index 1f467d99d..1b6cd1691 100644 --- a/app/assets/error_pages/5xx.html +++ b/app/assets/error_pages/5xx.html @@ -131,6 +131,13 @@ 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-75215134-1', 'auto'); + ga('set', 'anonymizeIp', true); + ga('set', 'displayFeaturesTask', null); + ga('set', 'transport', 'beacon'); + // strip UUIDs + page = (window.location.pathname + window.location.search).replace( + /[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}/g, '…' + ) ga('send', 'pageview'); diff --git a/app/templates/admin_template.html b/app/templates/admin_template.html index e1b0d7ee5..46b407e94 100644 --- a/app/templates/admin_template.html +++ b/app/templates/admin_template.html @@ -141,6 +141,9 @@ 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-75215134-1', 'auto'); + ga('set', 'anonymizeIp', true); + ga('set', 'displayFeaturesTask', null); + ga('set', 'transport', 'beacon'); // strip UUIDs page = (window.location.pathname + window.location.search).replace( /[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}/g, '…'