From 39e2314391f27661ef85e245f3f6421a3d763553 Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Mon, 7 Oct 2019 10:54:30 +0100 Subject: [PATCH] Set allowAdFeatures on linker tracker to false - was already set on our normal tracker, but not on the cross domain linking tracker --- .../analytics_toolkit/google-analytics-universal-tracker.js | 1 + .../google-analytics-universal-tracker.spec.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/assets/javascripts/analytics_toolkit/google-analytics-universal-tracker.js b/app/assets/javascripts/analytics_toolkit/google-analytics-universal-tracker.js index 8effb5766..e9eeaff6b 100644 --- a/app/assets/javascripts/analytics_toolkit/google-analytics-universal-tracker.js +++ b/app/assets/javascripts/analytics_toolkit/google-analytics-universal-tracker.js @@ -172,6 +172,7 @@ sendToGa(name + '.set', 'anonymizeIp', true) sendToGa(name + '.set', 'displayFeaturesTask', null) + sendToGa(name + '.set', 'allowAdFeatures', false) sendToGa(name + '.set', 'title', pii.stripPII(document.title)) sendToGa(name + '.set', 'location', pii.stripPII(window.location.href)) diff --git a/spec/javascripts/analytics_toolkit/google-analytics-universal-tracker.spec.js b/spec/javascripts/analytics_toolkit/google-analytics-universal-tracker.spec.js index 367ef796f..80e18fade 100644 --- a/spec/javascripts/analytics_toolkit/google-analytics-universal-tracker.spec.js +++ b/spec/javascripts/analytics_toolkit/google-analytics-universal-tracker.spec.js @@ -229,6 +229,9 @@ describe('GOVUK.GoogleAnalyticsUniversalTracker', function () { it('requires and configures the linker plugin', function () { expect(window.ga.calls.argsFor(callIndex + 1)).toEqual(['testTracker.require', 'linker']) }) + it('disables Ad features', function () { + expect(window.ga.calls.allArgs()).toContain(['set', 'allowAdFeatures', false]) + }) it('configures the domain', function () { expect(window.ga.calls.argsFor(callIndex + 2)).toEqual(['testTracker.linker:autoLink', ['some.service.gov.uk']]) })