Skip to main content

Consent events (Enhanced Consent)

Enhanced consent is the recommended way to track marketing consent events on your website.

Eventsโ€‹

Event: consent_preferences

Schema for consent preferences selection event

Schema URI:iglu:com.snowplowanalytics.snowplow/consent_preferences/jsonschema/1-0-0

WebMobileTracked automatically
โœ…โŒโŒ
๐Ÿ‘€ Example
{
"basisForProcessing": "consent",
"consentVersion": "1",
"consentScopes": [
"necessary",
"preferences",
"statistics"
],
"domainsApplied": [
"https://www.example.com/"
],
"consentUrl": "https://www.example.com/",
"eventType": "allow_selected",
"gdprApplies": false
}
๐Ÿ“ƒ Schema properties definition
PropertyTypeDescriptionRequired?
eventTypeOne of: deny_all, allow_all, allow_selected, pending, implicit_consent, withdrawn, expiredThe action for the consent preferences of a user.โœ…
basisForProcessingOne of: consent, contract, legal_obligation, vital_interests, public_task, legitimate_interestsGDPR lawful basis for data collection & processing.โœ…
consentUrl"string"URI of the privacy policy related document.โœ…
consentVersion"string"Version of the privacy policy related document.โœ…
consentScopes"array"The scopes allowed after the user finalized his selection of consent preferences. E.g ['analytics', 'functional', 'advertisement'].โœ…
domainsApplied"array"The domains for which this consent allows these preferences to persist to.โœ…
gdprApplies["boolean","null"]Determine if GDPR applies based on the user's geo-location.โŒ
โ“ How to query the event in the warehouse?
select
unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1_0_0
from
PIPELINE_NAME.events events
where
events.collector_tstamp > timestamp_sub(current_timestamp(), interval 1 hour)
and events.event = 'unstruct'
and events.event_name = 'consent_preferences'
and events.event_vendor = 'com.snowplowanalytics.snowplow'
Event: cmp_visible

Tracks the load time of Consent Management Platform (CMP) banners.

Schema URI:iglu:com.snowplowanalytics.snowplow/cmp_visible/jsonschema/1-0-0

WebMobileTracked automatically
โœ…โŒโŒ
๐Ÿ‘€ Example
{
"elapsedTime": 1.5
}
๐Ÿ“ƒ Schema properties definition
PropertyTypeDescriptionRequired?
elapsedTime"number"The time taken for the consent popup to be shown to the screen.โœ…
โ“ How to query the event in the warehouse?
select
unstruct_event_com_snowplowanalytics_snowplow_cmp_visible_1_0_0
from
PIPELINE_NAME.events events
where
events.collector_tstamp > timestamp_sub(current_timestamp(), interval 1 hour)
and events.event = 'unstruct'
and events.event_name = 'cmp_visible'
and events.event_vendor = 'com.snowplowanalytics.snowplow'

How to track?โ€‹

To track enhanced consent events using the JavaScript tracker on Web, you can make use of the Enhanced Consent plugin.

Modeled data using the snowplow-web dbt packageโ€‹

To process raw events created by the Snowplow Enhanced Consent plugin we have included an optional module to model consent events in the snowplow-web dbt package.

This custom module consists of a series of dbt models which produce the following aggregated models from the raw consent tracking events:

Derived tableTable description
snowplow_web_consent_logSnowplow incremental table showing the audit trail of consent and Consent Management Platform (cmp) eventsDocs
snowplow_web_consent_usersIncremental table of user consent tracking statsDocs
snowplow_web_consent_totalsSummary of the latest consent status, per consent versionDocs
snowplow_web_consent_scope_statusAggregate of current number of users consented to each consent scopeDocs
snowplow_web_cmp_statsUsed for modeling cmp_visible events and related metricsDocs
snowplow_web_consent_versionsIncremental table used to keep track of each consent version and its validityDocs

Visit the Consent Tracking for Marketing accelerator for an end-to-end tutorial on how to track and model consent data using Snowplow.

Older consent APIs and events

There is an option to track older consent granted and consent withdrawn events in our trackers. However, we recommend using the Enhanced Consent events as they are more up-to-date.

To learn how to track consent granted and withdrawn events, see:

The tracking consists of two events (consent_granted and consent_withdrawn) and two context entities (consent_document and gdpr).

Schema: consent_granted

Schema for consent granted

Schema URI:iglu:com.snowplowanalytics.snowplow/consent_granted/jsonschema/1-0-0

๐Ÿ“ƒ Schema properties definition
PropertyTypeDescriptionRequired?
expiry"string"โŒ
Schema: consent_withdrawn

Schema for consent withdrawn

Schema URI:iglu:com.snowplowanalytics.snowplow/consent_withdrawn/jsonschema/1-0-0

๐Ÿ“ƒ Schema properties definition
PropertyTypeDescriptionRequired?
all"boolean"โœ…
Schema: consent_document

Schema for consent document context

Schema URI:iglu:com.snowplowanalytics.snowplow/consent_document/jsonschema/1-0-0

๐Ÿ“ƒ Schema properties definition
PropertyTypeDescriptionRequired?
id"string"โœ…
version"string"โœ…
name"string"โŒ
description"string"โŒ
Schema: gdpr

Schema for a web page context

Schema URI:iglu:com.snowplowanalytics.snowplow/gdpr/jsonschema/1-0-0

๐Ÿ“ƒ Schema properties definition
PropertyTypeDescriptionRequired?
basisForProcessingOne of: consent, contract, legal_obligation, vital_interests, public_task, legitimate_interestsGDPR basis for data collection & processingโœ…
documentId["string","null"]ID for document detailing basis for processingโŒ
documentVersion["string","null"]Version of document detailing basis for processingโŒ
documentDescription["string","null"]Description of document detailing basis for processingโŒ