Skip to content

Commit

Permalink
chore: add deprecation note for DNT (#4020)
Browse files Browse the repository at this point in the history
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 <lbompart@coveo.com>
  • Loading branch information
samisayegh and louis-bompart authored Jun 4, 2024
1 parent 7aa6094 commit 41efb66
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/headless/src/app/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -207,9 +206,6 @@ const analyticsConfigurationSchema: SchemaDefinition<
export const updateAnalyticsConfiguration = createAction(
'configuration/updateAnalyticsConfiguration',
(payload: UpdateAnalyticsConfigurationActionCreatorPayload) => {
if (doNotTrack()) {
payload.enabled = false;
}
return validatePayload(payload, analyticsConfigurationSchema);
}
);
Expand Down
6 changes: 6 additions & 0 deletions packages/headless/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ export function getObjectHash<T>(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') {
Expand Down

0 comments on commit 41efb66

Please sign in to comment.