Active Cookie Consent for API Implementation

Active Cookie Consent enables you 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 how to pass the consent value via API. To learn more about implementing active consent on the client side (for Dynamic Yield script implementations), see Active Cookie Consent for Client-Side Implementation.

📌

Note that this article describes the API consent logic, but it doesn't activate Active Cookie Consent mode, which is the framework for the logic.

Contact Dynamic Yield Support to enable Active Cookie Consent mode.


Active consent means that a user is considered to be opted out until they actively opt in, and you need to notify Dynamic Yield when a user opts in (or opts out). User consent data must be sent in every API call, such as Choose, Engagement, Events, and so on.

To indicate the user’s preference, add the active_consent_accepted parameter. If you send requests without this parameter, or with an incorrect value, Dynamic Yield assumes that the visitor has not opted in (value of false).

Param

"user": {  
    "dyid": "-4350463893986789401",  
    "dyid_server": "-4350463893986789401"  
    "active_consent_accepted" :  // true or false  
}

How it works

  1. For first-time users, you don't send the user ID and session ID to Dynamic Yield in your request (not yet available).
  2. Dynamic Yield sets and returns the user ID and session ID in a cookie in the response.
  3. After Active Cookie Consent is turned on, Dynamic Yield can't return valid cookies unless the user has consented.
  4. If the user has opted out or not consented, Dynamic Yield sends a cookie with the user ID and session ID with a TTL (maxAge) of -1 (that is, the cookie is not saved, and if there was a cookie before, it's deleted). This way, you don't need to change your implementation, as the cookie expires immediately.