Skip to main content

For AI agents: a Markdown version of this page is at https://docs.snowplow.io/docs/sources/web-trackers/previous-versions/browser-tracker-v3-reference/plugins/consent.md. The index of all documentation pages is at https://docs.snowplow.io/llms.txt, and the index for this section is at https://docs.snowplow.io/docs/api-reference/llms.txt.

Consent

caution
You are reading documentation for an outdated version. Here's the latest one!

Latest release version badge for the Snowplow JavaScript Tracker

Installation​

  • npm install @snowplow/browser-plugin-consent
  • yarn add @snowplow/browser-plugin-consent
  • pnpm add @snowplow/browser-plugin-consent

Initialization​

javascript
import { newTracker, trackPageView } from '@snowplow/browser-tracker';
import { ConsentPlugin } from '@snowplow/browser-plugin-consent';

newTracker('sp1', '{{collector_url}}', {
appId: 'my-app-id',
plugins: [ ConsentPlugin() ],
});

Functions​

enableGdprContextDocumentation
trackConsentGrantedDocumentation
trackConsentWithdrawnDocumentation

Context​

Adding this plugin will automatically capture the following context:

ContextExample
iglu:com.snowplowanalytics.snowplow/consent_document/jsonschema/1-0-0Example consent document context JSON showing id, version, name, and description fields

Was this page helpful?