From 4ea7d806fbbe2556b1aff4ebc75b3cda9fd2cd4c Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 5 Oct 2016 10:58:33 +0100 Subject: [PATCH] Remove UUIDs from URLs sent to Google Analytics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If all our URLs are unique (because they contain service/job/template IDs) then it makes it hard to aggrate how users are behaving across a range of services/jobs/templates. This commit replaces anything that looks like a UUID in a URL with `…`. --- app/templates/admin_template.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/templates/admin_template.html b/app/templates/admin_template.html index aa57f52d5..4de2bf288 100644 --- a/app/templates/admin_template.html +++ b/app/templates/admin_template.html @@ -135,6 +135,10 @@ 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('send', 'pageview'); + // strip UUIDs + page = window.location.href.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', page); {% endblock %}