Skip to content

Conversation

@Niyibitanga
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for 9 new Consent Management Platform (CMP) integrations to Clarity's consent tracking system, adds an "Unknown" consent source, and makes adjustments to consent fallback behavior and cookie clearing logic.

  • Adds enum values for CMPs: MyAgilePrivacy, UserCentrics, Cookiebot, Axeptio, Cookiehub, CookieYes, WebTofee, WPConsent, and SeersAI (values 150-158)
  • Introduces ConsentSource.Unknown (value 255) and updates the fallback from Implicit to Unknown in getConsentData()
  • Changes cookie expiration parameter from -Number.MAX_VALUE to 0 in the clear() function

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/clarity-js/types/data.d.ts Adds 9 new CMP enum values (150-158), adds Unknown enum value (255), and includes a SharePoint reference URL in comments
packages/clarity-js/src/data/metadata.ts Updates default consent source fallback from Implicit to Unknown, changes cookie expiration values from -Number.MAX_VALUE to 0

export function clear(all: boolean = false): void {
// Clear any stored information in the cookie that tracks session information so we can restart fresh the next time
setCookie(Constant.SessionKey, Constant.Empty, -Number.MAX_VALUE);
setCookie(Constant.SessionKey, Constant.Empty, 0);
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the cookie expiration from -Number.MAX_VALUE to 0 may not properly clear the cookie in all browsers. The value 0 creates a cookie that expires "0 days from now", which could be interpreted differently by browsers. Using a negative value like -1 is the more standard approach to ensure cookies are immediately expired and deleted. Consider using -1 instead of 0 for more reliable cookie deletion across all browsers.

Copilot uses AI. Check for mistakes.
// Clear user cookie as well if all flag is set
if (all) {
setCookie(Constant.CookieKey, Constant.Empty, -Number.MAX_VALUE);
setCookie(Constant.CookieKey, Constant.Empty, 0);
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the cookie expiration from -Number.MAX_VALUE to 0 may not properly clear the cookie in all browsers. The value 0 creates a cookie that expires "0 days from now", which could be interpreted differently by browsers. Using a negative value like -1 is the more standard approach to ensure cookies are immediately expired and deleted. Consider using -1 instead of 0 for more reliable cookie deletion across all browsers.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants