Prerequisites

The prerequisites for using the Web SDK are listed here.

On that page, there’s a requirement for an “Event Dataset” and, just like it sounds, this is a dataset to hold your experience event data. To send consent information with events, the IAB TCF 2.0 Consent Details field group needs to be added to your Experience Event schema:

For the Platform consent standard v2.0, we’ll also need access to Adobe Experience Platform to create an XDM Individual Profile schema and dataset. For a tutorial on schema creation, see Create a schema using the Schema Editor and for the required Consent and Preference Details field group see Configure a dataset to capture consent and preference data.

This tutorial assumes you have access to Data Collection and have created a client-side Tags property with the Web SDK extension installed and a working library created and built for development. These topics are detailed and demonstrated in these documents:

We’ll also use the Platform Debugger Chrome extension to inspect and validate our implementation.

To implement the IAB TCF example with a CMP on your own site, you’ll need access to a CMP like OneTrust or Sourcepoint to generate the data they provide, or you can simply follow along here and see the results below.

NOTE
The 1.0 standard is being phased out in favor of v2.0. The 2.0 standard allows you to add additional consent data that can be used to manually enforce consent preferences. The screenshots below of the Platform Web SDK extension are from version 2.4.0 of the extension which is compatible with either v1.0 or v2.0 of the Adobe Consent Standard.

For more information on these standards, see Supporting customer consent preferences.

After we’ve installed the Platform Web SDK extension in a Tags property, we can configure the options for addressing consent data on the extension configuration screen:

The “Privacy” section sets the consent level for the SDK if the user has not previously provided consent preferences. This sets the default state for consent and event data collection in the SDK. The chosen setting answers the question of “what should the SDK do if the user has not yet provided explicit consent preferences?”

  • In - Collect events that occur before the user provides consent preferences.
  • Out - Drop events that occur before the user provides consent preferences.
  • Pending - Queue events that occur before the user provides consent preferences.
  • Provided by data element

If the default consent setting is “In”, this tells the SDK that it should not wait for explicit consent and it should collect the events that occur before the user provides consent preferences. These preferences are typically handled and stored in a CMP.

If the default consent setting is “Out”, this tells the SDK that it should not collect any events that occur before the user opt-in preferences are set. Visitor activity that occurs before setting the consent preference will not be included in any data sent by the SDK after consent is set. For example, if you scroll and view a web page before you select the consent banner, and this “Out” setting is used, that scroll activity and viewing time will not be sent if the user later provides explicit consent for data collection.

If the default consent setting is “Pending”, the SDK will queue any events that occur before the user provides consent preferences, so the events may be sent after consent preferences are set, and after the SDK is initially configured during a visit.

With this “Pending” setting, attempting to execute any commands that require user opt-in preferences (for example, the event command) will result in the command being queued within the SDK. These commands are not processed until you have communicated the user’s opt-in preferences to the SDK.

Once a CMP collects the user’s preferences, then we can communicate those preferences to the SDK. In a later section below, we’ll see how to obtain that opt-in data and use it with the Web SDK extension.

“Provided by data element” allows us to access a data element containing any consent preference data captured by custom code or a CMP on your site, or in your data layer. A data element used for this purpose should resolve to “in”, “out”, or “pending”.

Please note: this configuration setting for the SDK is not persisted to users’ profiles, it is specific to setting the behavior of the SDK before explicit consent preferences are provided by the visitor.

To learn more about configuring the Web SDK extension see the Platform Web SDK extension overview and Supporting customer consent preferences.

For this example, let’s choose the option for “Pending” and select Save to save our configuration settings.

Now that we’ve set the default behavior of the SDK, we can use tags to send a visitor’s explicit consent preferences to Platform. Sending consent data using the Adobe 1.0 or 2.0 standard is easily implemented using the setConsent action of the Web SDK in your tag rules.

Let’s create a rule to demonstrate this. In your Platform tag property, select Rules, then on the blue Add Rules button. Let’s name the Rule “setAdobeConsent” and select to add an Event. For the Event Type, choose “Window Loaded” which will trigger this rule whenever a page is loaded on our website. Next, under “Actions” select “Add” to open the action configuration screen. This is where we’ll set the consent data. Select the “Extension” dropdown and select “Platform Web SDK”, then select the “Action Type” and select “Set Consent”.

Under “Consent Information”, choose “Fill out a form”. In this rule action, we’ll use the Web SDK to set consent for the Adobe 1.0 consent standard by filling in the form displayed:

We can choose to pass “In”, “Out”, or “Provided by data element” with this Set Consent action. A data element here should resolve to “in” or “out”.

In this example, we’ll select “In” to indicate the visitor has consented to allowing the Web SDK to send data to Platform. Select the blue “Keep Changes” button to save this action, then “Save” to save this rule.

Note: Once a website visitor has opted out, the SDK will not allow you to set the users consent to in.

Your tag rules can be triggered by a variety of built-in or custom events which can be used to pass this consent data at the appropriate time during a visitor session. In the above example, we used the window loaded event to trigger the rule. In a later section, we’ll use a consent preference event from a CMP to trigger a Set Consent action. You can use a Set Consent action in a rule triggered by any event you prefer that indicates an opt-in preference setting.