Custom storefront consent management
For custom storefronts, Chord supports consent management through third-party consent management platforms (CMPs). This guide covers integrating your CMP with Chord's analytics library.
Supported Consent Providers
The @chordcommerce/analytics library supports the following consent adapters:
Provider | consent Value |
|---|---|
OneTrust | "onetrust" |
Ketch | "ketch" |
Configuration
To enable consent management, add the consent and optionally awaitConsent options when initializing:
const chord = new ChordAnalytics({
consent: 'onetrust', // Your consent provider
awaitConsent: true, // Wait for consent before sending events
cdpDomain: process.env.CHORD_DOMAIN,
cdpWriteKey: process.env.CHORD_WRITE_KEY,
// ... rest of config
})Options
Option | Type | Default | Description |
|---|---|---|---|
consent | string | — | The consent adapter to use: "onetrust" or "ketch" |
awaitConsent | boolean | false | If true, delays sending events until consent is given. Events will queue but not forward to destinations until consent is granted. Timeout is 1 minute — if consent is not given within that time, events are dropped. |
How It Works
When a consent adapter is configured:
- Chord reads the customer's consent preferences from your CMP.
- A consent object is attached to every event sent to Chord.
- Chord uses your configured consent category mappings to determine which destinations receive each event.
Configuring Consent Categories in Chord
Navigate to Consent Categories in the Chord platform to create consent category mappings. Map each category from your CMP to the appropriate destinations.
For each category, choose which destinations should receive events when the customer has consented to that category. Destinations not mapped to any category will receive all events regardless of consent.
Consent Value | Category Keys Reported | Source |
|---|---|---|
onetrust | OneTrust group IDs — C0001, C0002, C0003, … plus any custom group IDs | GetDomainData().Groups[].CustomGroupId |
cookiebot | necessary, preferences, statistics, marketing | window.Cookiebot.consent |
ketch | Your Ketch purpose keys — no fixed list, whatever is in the object | window.ketchConsent |
shopify | analytics, marketing, preferences, sale_of_data | Customer Privacy API |
segment | customPreferences keys merged with destinationPreferences keys | window.segmentConsent |
| | |
OneTrust
If using OneTrust as your CMP:
- Install and configure OneTrust on your site according to their documentation.
- Set consent: "onetrust" in your Chord configuration.
- Chord will automatically read consent preferences from OneTrust's API and include them with events.
Without a Supported CMP
If your consent management platform is not in the supported list, you can manage consent manually using the generic track method to include consent data, or contact [email protected] to discuss adding support for your provider.