Skip to content

chore: change from delayed flow to include consent#376

Draft
davidnuescheler wants to merge 9 commits into
mainfrom
marketing-tech
Draft

chore: change from delayed flow to include consent#376
davidnuescheler wants to merge 9 commits into
mainfrom
marketing-tech

Conversation

@davidnuescheler

Copy link
Copy Markdown
Contributor

changing the flow of loading marketing tech based on a conditions / events such as consent

https://marketing-tech--aem-boilerplate--adobe.aem.page/

@aem-code-sync

aem-code-sync Bot commented Jun 27, 2024

Copy link
Copy Markdown

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

@davidnuescheler davidnuescheler marked this pull request as draft June 27, 2024 21:53
@aem-code-sync

aem-code-sync Bot commented Jun 27, 2024

Copy link
Copy Markdown
Page Scores Audits Google
📱 / PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ / PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@davidnuescheler davidnuescheler changed the title chore: change initial flow chore: change initial delayed flow to include consent Jun 27, 2024
@davidnuescheler davidnuescheler changed the title chore: change initial delayed flow to include consent chore: change from delayed flow to include consent Jun 27, 2024
Comment thread scripts/scripts.js Outdated
Comment on lines +125 to +126
if (consentStatus === 'declineAll') return false;
return true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (consentStatus === 'declineAll') return false;
return true;
if (consentStatus === 'acceptAll') return true;
return false;

Comment thread scripts/scripts.js Outdated
if (consentStatus !== null) return mapStatus(consentStatus);
return new Promise((resolve) => {
// display consent banner
document.addEventListener('aem:changeconsent', (e) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
document.addEventListener('aem:changeconsent', (e) => {
document.addEventListener('aem:consentchange', (e) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually, who fires this event ? Adding an event listener in a check method is not a good practice. If I call the checkConsent method multiple times, the document will have multiple similar listeners.

@aem-code-sync aem-code-sync Bot temporarily deployed to marketing-tech July 10, 2024 21:39 Inactive
Comment thread scripts/consent.js Outdated
@fkakatie

fkakatie commented Feb 3, 2026

Copy link
Copy Markdown
Member

Hi @davidnuescheler - I've updated this branch to resolve merge conflicts with main and addressed some of the reviewer feedback:

Changes Made

Simplified mapStatus logic - Changed !(status === 'declineAll') to status !== 'declineAll' for clarity (addressing my own feedback 🫠 )

Added null check for missing fragment - Now handles missing consent banner fragment, defaulting to 'declineAll' instead of crashing

Remaining Questions

  1. Event naming - Currently dispatches 'consent' event. @kptdobe suggested 'aem:consentchange' for namespacing. Preference?

  2. Hardcoded path - /drafts/uncled/consent-banner is hardcoded. Obviously needs to be configurable.

  3. Event listener accumulation - @kptdobe raised concerns about listeners being registered inside handleConsent(). Since handleConsent() is only called once per page load (scripts.js:144), this doesn't cause issues in practice, but happy to entertain refactors.

Status Check

This PR has been open since June 2024. Are you still interested in pursuing this consent flow approach, or should we close this in favor of a different solution?

@perezdjulioarturo-stack

Copy link
Copy Markdown

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.

5 participants