Skip to content

Conversation

@ekremney
Copy link
Member

@ekremney ekremney commented Feb 14, 2025

Changes

Instead of reading cookies directly, now we use the OneTrust Banner SDK to catch the OneTrust events.

Motivation

We currently don't track the "banner closed" (if) happens after "banner shown". This is especially important to calculate the bounces caused by the cookie consent banner robustly.

this PR introduces a new target close to the consent checkpoint.

Note: if we decide to go with this impl, I will adjust the tests.

Here's an alternative implementation for the close event keeping everything else the same: #374

@adobe-bot
Copy link
Collaborator

This PR will trigger a minor release when merged.

@aem-code-sync
Copy link

aem-code-sync bot commented Feb 14, 2025

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

return;
}
// eslint-disable-next-line no-param-reassign
sampleRUM.oneTrustTrackingSet = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you need this exposed on the object? we could just use a local variable, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure, would a local variable cut it? what happens if addCookieConsentTracking(sampleRUM) called twice?

Copy link
Collaborator

Choose a reason for hiding this comment

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

There should be only 1 sampleRUM instance… so it would be the same problem.
You could bail out with a conditional if it is called a 2nd time

Copy link
Collaborator

@chicharr chicharr left a comment

Choose a reason for hiding this comment

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

Hi @ekremney
couple of comments:

  1. with this new approach if a visitor who already closed the the banner before in a previous visit, leaves the page before OneTrust is loaded, we will not track the hidden checkpoint.
  2. A cosmetic issue. We are defining an object window.OneTrust in sites where OneTrust is not installed, right?

@ekremney
Copy link
Member Author

@chicharr

  1. we keep that functionality, the IsAlertBoxClosed checks the cookie underneath: https://developer.onetrust.com/onetrust/docs/javascript-api#is-optanonalertboxclosed-cookie-set
if (oneTrust.IsAlertBoxClosed()) {
  sampleRUM('consent', { source: 'onetrust', target: 'hidden' });
}
  1. window.OneTrust will return undefined until someone explicitly sets a value via window.OneTrust = ...

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.

4 participants