Active Cookie Consent Client-Side Implementation Guide

For Experience API implementation, see the API cookie consent guide.

Active Cookie Consent enables your website to tell Dynamic Yield whether a user has consented to cookies, so Dynamic Yield can apply the correct data collection and personalization behavior.

This guide explains the client-side implementation for sites that use the Dynamic Yield script, including consent handling at page load and during runtime.


Both APIs set the user’s accepted value to true (consent granted) or false (consent denied or no stored consent).

Set this value based on the user’s existing or updated consent choice, applicable regulations, or based on your default consent handling when no prior consent is available.


Page-load declaration

Set the user consent status before the Dynamic Yield script loads:

DY.userActiveConsent = { accepted: <true | false> };

This declaration must be included on every page

⚠️

Important: DY.userActiveConsent at runtime

  • Do not update this value at runtime. The system reads it only during page load.
  • Do not use this value to evaluate consent at runtime. It doesn't reflect updates made after page load.

Runtime update

Update the user’s consent status after the script loads:

DYO.ActiveConsent.updateConsentAcceptedStatus(<true | false>);

Verification

  1. Verify API implementations using Preview Site (Settings › Data Privacy › Active Cookie Consent)
  2. Contact Dynamic Yield Support to enable Active Cookie Consent.
  3. At any time, check current consent status using:
DYO.ActiveConsent.isUserOptOut() ? 'Consent not granted' : 'Consent granted';