Active Cookie Consent Client-Side Implementation
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. Learn more about active consent in The Dynamic Yield Privacy Center.
Set the user's consent status
Use DY.userActiveConsent to declare, update, and verify a user's consent status.
DY.userActiveConsent = { accepted: <true | false> };true– User has granted consentfalse– User has not granted consent, had denied consent, or consent status is unknown
Set the value to reflect the user's current consent status. If no valid consent signal exists, use false.
You can set this property before the dynamic Yield script loads, and update it later whenever the user consent status changes.
Common implementation scenarios
- Consent available at page load: If your site already knows the user's consent status when the page loads, set the API to declare the status before the page loads.
- Consent granted or withdrawn during the session: A user can grant or deny consent at any juncture you provide on your site, such as a cookie management panel or consent popup.
- Consent verification: At any time, you can check the value of
DY.userActiveConsent.acceptedto determine a user's consent status.
Verification and enablement
- Implement the API on your site. It is ignored until active cookie consent is enabled.
- In Experience OS › Settings › Data Privacy › Active Cookie Consent, click Preview to experience the site as if active cookie consent is enabled.
- After successful verification, contact Dynamic Yield Support to enable active cookie consent.
Updated 6 days ago
