Set consent

The Set consent action determines if the tag extension should send data (opt in), discard data (opt out), or use default consent (consent unknown). When a user allows or denies consent on your site, you can use this action to sync their preferences with the tag extension. The JavaScript library equivalent of this action is the setConsent command.

  1. Log in to experience.adobe.com using your Adobe ID credentials.
  2. Navigate to Data Collection > Tags.
  3. Select the desired tag property.
  4. Navigate to Rules, then select the desired rule.
  5. Under Actions, select an existing action or create an action.
  6. Set the Extension dropdown field to Adobe Experience Platform Web SDK, then set the Action type to Set consent.

The tag extension supports the following standards:

Adobe recommends that you store any consent dialog preferences separately, such as in a data element. The tag extension does not offer a way to retrieve consent. To make sure that the user preferences stay in sync with the tag extension, you can this action on every page load.

Available fields

This action type supports the following configuration options:

  • Instance: The SDK instance that the action applies to. This drop-down menu is disabled if your implementation uses a single SDK instance.
  • Identity map: A data element that controls how an ECID is generated and which IDs consent information is tied to.
  • Consent information: Determines if you want to fill out a form, or provide a data element containing consent information.
  • Standard: The consent standard that you want to use. Available options include ‘Adobe’ and ‘IAB TCF’.
  • Version: The version of the consent standard that you want to use.
  • Datastream configuration overrides: This command supports datastream configuration overrides, giving you control over which apps and services receive this data. When you set a datastream configuration override in both an individual command and within the tag extension configuration settings, the individual command takes precedence. See Datastream configuration overrides for more information.

An ideal time to use this action is when a customer’s consent preferences have changed. You can create a tag rule to listen for this change.

  1. Within a tag property, navigate to Rules and select Add rule.

  2. Give the rule a desired name, then select the ‘+’ icon next to Events.

  3. Set the following properties on the left:

    • Extension: Core
    • EVent type: Custom code
  4. Open the editor on the right and use the following code as a template:

// Wait for window.__tcfapi to be defined, then trigger when the customer has completed their consent and preferences.
function addEventListener() {
  if (window.__tcfapi) {
    window.__tcfapi("addEventListener", 2, function (tcData, success) {
      if (success && tcData.eventStatus === "useractioncomplete") {
        // save the tcData.tcString in a data element
        _satellite.setVar("IAB TCF Consent String", tcData.tcString);
        _satellite.setVar("IAB TCF Consent GDPR", tcData.gdprApplies);
        trigger();
      }
    });
  } else {
    // window.__tcfapi wasn't defined. Check again in 100 milliseconds
    setTimeout(addEventListener, 100);
  }
}
addEventListener();
  1. Select Keep changes.

The above custom code block does two things:

  • Triggers the rule when the consent preferences have changed.
  • Sets two data elements: IAB TCF Consent String and IAB TCF Consent GDPR.

These data elements are useful when setting the ‘Set Consent’ action:

  1. Select the ‘+’ icon next to Actions.

  2. Set the following properties on the left:

    • Extension: Adobe Experience Platform Web SDK
    • Action type: Set consent
  3. Set the following properties on the right:

    • Standard: IAB TCF
    • Version: 2.0
    • Value: %IAB TCF Consent String%
    • Does GDPR apply to this consent value: Provide a data element, with the value %IAB TCF Consent GDPR%

IAB Set Consent Action

NOTE
You cannot choose these data elements using the data element selector because they were created through custom code. You must type in the data element name with the percent signs.
recommendation-more-help
12b4e4a9-5028-4d88-8ce6-64a580811743