From 41efb66a027ab6b7b680d39d7515a57b0c437bc7 Mon Sep 17 00:00:00 2001 From: Sami Sayegh Date: Tue, 4 Jun 2024 02:10:24 -0400 Subject: [PATCH] chore: add deprecation note for DNT (#4020) The PR adds a deprecation note to remove DNT as part of the next major release. The decision is captured [here](https://coveord.atlassian.net/browse/LENS-1502?focusedCommentId=764668). The main drivers were: - DNT is an outdated standard. Newer standards like GPC have been introduced. We don't believe it's Coveo's role to update libraries to adhere to the latest standards? - Privacy standards differ around the world. Baking a single privacy stance into Coveo's libraries and apis will be overly restrictive in certain geographies. **Aside** I tried to adjust the logic in headless to only apply DNT if the analyticsMode is `legacy`. However, this required changing an action to an thunk. The signature change created multiple typescript errors, and so seems like it's breaking. I changed course to add a deprecation note instead. With the v3 release around the corner, it seems less risky to simply remove the `doNotTrack` function rather than making a signature change. --------- Co-authored-by: Louis Bompart --- packages/headless/src/app/engine.ts | 3 ++- .../src/features/configuration/configuration-actions.ts | 4 ---- packages/headless/src/utils/utils.ts | 6 ++++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/headless/src/app/engine.ts b/packages/headless/src/app/engine.ts index b95c0fc76a6..1e2d5430d41 100644 --- a/packages/headless/src/app/engine.ts +++ b/packages/headless/src/app/engine.ts @@ -198,7 +198,8 @@ function getUpdateAnalyticsConfigurationPayload( apiBaseUrl, }; - if (doNotTrack()) { + // TODO KIT-2844 + if (payloadWithURL.analyticsMode !== 'next' && doNotTrack()) { logger.info('Analytics disabled since doNotTrack is active.'); return { ...payloadWithURL, diff --git a/packages/headless/src/features/configuration/configuration-actions.ts b/packages/headless/src/features/configuration/configuration-actions.ts index b29f49dc091..12c6dc3e16b 100644 --- a/packages/headless/src/features/configuration/configuration-actions.ts +++ b/packages/headless/src/features/configuration/configuration-actions.ts @@ -8,7 +8,6 @@ import { } from '@coveo/bueno'; import {createAction} from '@reduxjs/toolkit'; import {IRuntimeEnvironment} from 'coveo.analytics'; -import {doNotTrack} from '../../utils/utils'; import { nonEmptyString, validatePayload, @@ -207,9 +206,6 @@ const analyticsConfigurationSchema: SchemaDefinition< export const updateAnalyticsConfiguration = createAction( 'configuration/updateAnalyticsConfiguration', (payload: UpdateAnalyticsConfigurationActionCreatorPayload) => { - if (doNotTrack()) { - payload.enabled = false; - } return validatePayload(payload, analyticsConfigurationSchema); } ); diff --git a/packages/headless/src/utils/utils.ts b/packages/headless/src/utils/utils.ts index 8bcd5733842..f6d6adc763f 100644 --- a/packages/headless/src/utils/utils.ts +++ b/packages/headless/src/utils/utils.ts @@ -45,9 +45,15 @@ export function getObjectHash(obj: T) { } const doNotTrackValues = new Set(['1', 1, 'yes', true]); +// TODO KIT-2844 /** * Logic copied from coveo.analytics. + * + * @deprecated Starting with Event Protocol, Coveo will no longer respect the DNT standard. + * Instead, we will provide implementers with documentation on privacy best-practices, letting + * them decide which standards to respect. + * For more context behind the decision, see: https://coveord.atlassian.net/browse/LENS-1502 */ export function doNotTrack() { if (typeof navigator === 'undefined' || typeof window === 'undefined') {