From a3cbae9802678cec8c1c19f7e8f559ac627c61ac Mon Sep 17 00:00:00 2001 From: George Goodall Date: Fri, 8 Dec 2023 14:18:37 +0000 Subject: [PATCH 1/2] force do not track --- assets/javascripts/cookies.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/javascripts/cookies.js b/assets/javascripts/cookies.js index c9787371..4ef8b5ff 100644 --- a/assets/javascripts/cookies.js +++ b/assets/javascripts/cookies.js @@ -89,7 +89,7 @@ export function showCookieConfirmation () { export function setTrackingCookies () { var cookiesPolicy = JSON.parse(getCookie('cookies_policy')) - var doNotTrack = cookiesPolicy == null || !cookiesPolicy.usage + var doNotTrack = true; //cookiesPolicy == null || !cookiesPolicy.usage if (doNotTrack) { if(window.gaMeasurementId){ window[`ga-disable-${window.gaMeasurementId}`] = true; From 3ea71cbce13554c4d41d2fd63373d3698b98da6f Mon Sep 17 00:00:00 2001 From: George Goodall Date: Fri, 8 Dec 2023 14:25:12 +0000 Subject: [PATCH 2/2] fixed test --- tests/unit/javascript/cookies.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/javascript/cookies.test.js b/tests/unit/javascript/cookies.test.js index 5608bfa7..d8554ff1 100644 --- a/tests/unit/javascript/cookies.test.js +++ b/tests/unit/javascript/cookies.test.js @@ -141,10 +141,10 @@ describe('cookies.js', () => { window.gaMeasurementId = fakeMeasurementId; setCookie('cookies_policy', JSON.stringify({usage: true})); setTrackingCookies(); - expect(window[`ga-disable-${fakeMeasurementId}`]).toBe(false); + expect(window[`ga-disable-${fakeMeasurementId}`]).toBe(true); - expect(Array.from(dataLayer[0])).toEqual(['js', new Date()]); - expect(Array.from(dataLayer[1])).toEqual(['config', fakeMeasurementId]); + // expect(Array.from(dataLayer[0])).toEqual(['js', new Date()]); + // expect(Array.from(dataLayer[1])).toEqual(['config', fakeMeasurementId]); }) })