defaultConsent
The defaultConsent
property determines how you handle data collection consent before you call the setConsent
command. This property is valuable when you don’t want to accidentally collect data from individuals who reside in areas where consent is required before collecting data.
By default, users are opted in to all purposes, and the Web SDK is allowed to perform the following tasks:
- Send data to and from Adobe’s servers.
- Read and write cookies or web storage items.
If users opt out of all purposes, the Web SDK does not perform any of these tasks.
The defaultConsent
property supports three values:
in
: Data collection proceeds as normal, until the user opts out.out
: Data is permanently discarded until the user opts in.pending
: Data is stored locally until the user opts in using thesetConsent
command. When the default consent for the general purpose is set topending
, attempting to execute any commands that depend on user opt-in preferences (for example, thesendEvent
command) results in the command being queued in the Web SDK. Queued commands are not processed until you have communicated the user’s opt-in preferences to the Web SDK.
If you have a visitor that is not within the jurisdiction of General Data Protection Regulation (GDPR), the default consent could be set to in
. Visitors inside the jurisdiction of GDPR could have their default consent set to pending
. Your Consent Management Platform (CMP) can detect the customer’s region and provide the flag gdprApplies
to IAB TCF 2.0. This flag can be used to set the default consent.
If you do not want to collect events that occurred before the user’s opt-in preferences are set, you can pass "defaultConsent": "out"
during Web SDK configuration. Attempting to execute any commands that depend on user opt-in preferences will have no effect until you have communicated the user’s opt-in preferences to the Web SDK.
Using defaultConsent
together with setConsent
using-consent
The Web SDK offers two complementary consent configuration commands:
defaultConsent
: This command is meant to capture the consent preferences of Adobe customers using Web SDK.setConsent
: This command is meant to capture the consent preferences of your site visitors.
When used together, these settings can lead to different data collection and cookie setting results, depending on their configured values.
See the table below to understand when data collection occurs and when cookies are set, based on consent settings.
in
in
in
out
in
pending
in
pending
out
pending
out
in
out
out
out
The following cookies are set when the consent configuration allows:
idMigrationEnabled
is enabled. It helps when transitioning to Web SDK while some parts of the site are still using visitor.js
.s_ecid=MCMID|<ECID>
.Set default consent using the Web SDK tag extension
Select the desired radio button under Default consent when configuring the tag extension.
- Log in to experience.adobe.com using your Adobe ID credentials.
- Navigate to Data Collection > Tags.
- Select the desired tag property.
- Navigate to Extensions, then click Configure on the Adobe Experience Platform Web SDK card.
- Scroll down to the Privacy section, then select the desired Default consent.
- Click Save, then publish your changes.
Set default consent using the Web SDK JavaScript library
Set the defaultConsent
string property to the desired consent level when running the configure
command. This property is case-sensitive, and supports only the following three values: "in"
, "out"
, and "pending"
. If you attempt to use any other value, the library throws an error.
alloy("configure", {
datastreamId: "ebebf826-a01f-4458-8cec-ef61de241c93",
orgId: "ADB3LETTERSANDNUMBERS@AdobeOrg",
defaultConsent: "pending"
});