Skip to content

Conversation

@cy-moi
Copy link
Contributor

@cy-moi cy-moi commented Sep 30, 2025

Motivation

We want to remove the anonymous id from the cookie when consent is not granted.

Changes

  • Create the anonymous Id if it is not present only on startSession
  • Pass in hasConsent boolean when the consent is not-granted and remove the anonymous Id accordingly
  • ( cr. to @BenoitZugmeyer )

Test instructions

  • Start local SDK
  • Retract consent in the console
  • anonymousId should not present in cookie anymore

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.

@cy-moi cy-moi force-pushed the congyao/remove-aid-when-consent-revoke-alt2 branch from 1f081a8 to de468a8 Compare September 30, 2025 15:22
@cit-pr-commenter
Copy link

cit-pr-commenter bot commented Sep 30, 2025

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 162.82 KiB 162.85 KiB +36 B +0.02%
Rum Recorder 19.78 KiB 19.78 KiB 0 B 0.00%
Rum Profiler 4.89 KiB 4.89 KiB 0 B 0.00%
Logs 56.50 KiB 56.54 KiB +36 B +0.06%
Flagging 944 B 944 B 0 B 0.00%
Rum Slim 119.78 KiB 119.81 KiB +36 B +0.03%
Worker 23.60 KiB 23.60 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base CPU Time (ms) Local CPU Time (ms) 𝚫%
RUM - add global context 0.0041 0.0061 +48.78%
RUM - add action 0.0153 0.0237 +54.90%
RUM - add error 0.0134 0.0182 +35.82%
RUM - add timing 0.0031 0.0055 +77.42%
RUM - start view 0.004 0.0049 +22.50%
RUM - start/stop session replay recording 0.0007 0.0009 +28.57%
Logs - log message 0.0142 0.0184 +29.58%
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 25.83 KiB 25.72 KiB -118 B
RUM - add action 46.57 KiB 44.91 KiB -1.66 KiB
RUM - add timing 24.55 KiB 25.37 KiB +832 B
RUM - add error 51.08 KiB 49.40 KiB -1.67 KiB
RUM - start/stop session replay recording 23.54 KiB 24.83 KiB +1.29 KiB
RUM - start view 420.30 KiB 427.79 KiB +7.49 KiB
Logs - log message 43.18 KiB 41.71 KiB -1.47 KiB

🔗 RealWorld

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Sep 30, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 100.00%
Total Coverage: 92.62% (-0.01%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: b3cdd4a | Docs | Was this helpful? Give us feedback!

@cy-moi cy-moi marked this pull request as ready for review October 1, 2025 08:19
@cy-moi cy-moi requested a review from a team as a code owner October 1, 2025 08:19
@cy-moi cy-moi force-pushed the congyao/remove-aid-when-consent-revoke-alt2 branch 5 times, most recently from ef99cc4 to c18f1ea Compare October 3, 2025 16:55
Comment on lines 21 to 27
hasConsent: boolean = true
): SessionState {
const expiredSessionState: SessionState = {
isExpired: EXPIRED,
}
if (configuration.trackAnonymousUser) {
if (previousSessionState?.anonymousId) {
expiredSessionState.anonymousId = previousSessionState?.anonymousId
} else {
expiredSessionState.anonymousId = generateUUID()
}
if (hasConsent && configuration.trackAnonymousUser && previousSessionState?.anonymousId) {
expiredSessionState.anonymousId = previousSessionState?.anonymousId
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: remove the hasConsent parameter as it's not used anymore

@cy-moi cy-moi force-pushed the congyao/remove-aid-when-consent-revoke-alt2 branch from 915ea40 to 8f278ab Compare October 6, 2025 15:29
@cy-moi cy-moi force-pushed the congyao/remove-aid-when-consent-revoke-alt2 branch from fd1cb60 to b3cdd4a Compare October 16, 2025 09:39
@cy-moi cy-moi merged commit 8033316 into main Oct 16, 2025
20 checks passed
@cy-moi cy-moi deleted the congyao/remove-aid-when-consent-revoke-alt2 branch October 16, 2025 10:59
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