Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: change from delayed flow to include consent #376

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

davidnuescheler
Copy link
Contributor

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

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

Copy link

aem-code-sync bot commented Jun 27, 2024

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
Copy link

aem-code-sync bot commented Jun 27, 2024

Page Scores Audits Google
/ 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 on lines 125 to 126
if (consentStatus === 'declineAll') return false;
return true;
Copy link
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;

if (consentStatus !== null) return mapStatus(consentStatus);
return new Promise((resolve) => {
// display consent banner
document.addEventListener('aem:changeconsent', (e) => {
Copy link
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
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.

/* main consent handler */
export default async function handleConsent() {
const mapStatus = (consentStatus) => {
if (consentStatus === 'declineAll') return false;
Copy link
Member

Choose a reason for hiding this comment

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

return consentStatus !== 'declineAll';? Or is that unclear?

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