Skip to main content

CMP Integration Guide for Ventrata Checkout Widget

This guide will help you implement a Consent Management Platform (CMP) with the Ventrata Checkout Widget...

Updated today

... to ensure GDPR compliance and proper handling of user consent across analytics and tracking systems.


Overview

The Ventrata Checkout Widget can receive user consent preferences from your Consent Management Platform (CMP). This ensures that tools like analytics, ads and personalisation respect GDPR and other data privacy laws.

Using the window.Ventrata.updateConsents() method, you can dynamically pass user consent preferences directly to the widget.


Quick Start

After the widget has loaded on your page, update the consent values like this:

window.Ventrata.updateConsents({
analytics_storage: true,
ad_storage: false,
security_storage: true,
personalization_storage: false,
functionality_storage: true
});

Call this method once when the page loads, and again whenever the user changes their consent preferences.


Supported Consent Categories

Consent Key

Description

Applies To

analytics_storage

Storage of analytics data

PostHog

Google Analytics

Segment analytics

ad_storage

Storage for advertising

Google Ads

Re-marketing

Segment advertising

security_storage

Storage for security

Authentication

Fraud prevention

personalization_storage

Storage for personalisation

User preferences

Segment targeting

functionality_storage

Storage for enhanced functionality

User settings

Segment functional tracking


Integration Examples with Common CMPs

OneTrust

window.OneTrust.OnConsentChanged(function() {
const activeGroups = window.OnetrustActiveGroups;

window.Ventrata.updateConsents({
analytics_storage: activeGroups.includes('C0002'),
ad_storage: activeGroups.includes('C0004'),
security_storage: activeGroups.includes('C0001'),
personalization_storage: activeGroups.includes('C0003'),
functionality_storage: activeGroups.includes('C0003')
});
});


Cookiebot

window.addEventListener('CookiebotOnAccept', function() {
window.Ventrata.updateConsents({
analytics_storage: window.Cookiebot.consent.statistics,
ad_storage: window.Cookiebot.consent.marketing,
security_storage: window.Cookiebot.consent.necessary,
personalization_storage: window.Cookiebot.consent.preferences,
functionality_storage: window.Cookiebot.consent.preferences
});
});


Implementation Steps

Step 1: Set Initial Consent Defaults

On page load, set a safe default (usually false) before user consent is given:

window.Ventrata.updateConsents({
analytics_storage: false,
ad_storage: false,
security_storage: false,
personalization_storage: false,
functionality_storage: false
});

Step 2: Update Consent When User Makes a Choice

For example, after a user interacts with a CMP modal or preferences panel:

document.getElementById('save-preferences').addEventListener('click', function() { 
const consents = {
analytics_storage: document.getElementById('analytics-consent').checked,
ad_storage: document.getElementById('advertising-consent').checked,
security_storage: true, // Often essential
personalization_storage: document.getElementById('personalization-consent').checked,
functionality_storage: document.getElementById('functional-consent').checked
};

window.Ventrata.updateConsents(consents);
saveUserConsents(consents); // Replace with your CMP's consent saving logic
});


Type Safety (For TypeScript Projects)

interface ConsentRights {
analytics_storage: boolean;
ad_storage: boolean;
security_storage: boolean;
personalization_storage: boolean;
functionality_storage: boolean;
}

interface GTMConsentRights extends ConsentRights {
ad_user_data: boolean;
ad_personalization: boolean;
}

const updateConsent = (consent: Partial<ConsentRights | GTMConsentRights>) => {
window.Ventrata.updateConsents(consent);
};


Troubleshooting

❌ Consent Changes Don’t Apply

✅ Ensure the Ventrata widget has fully loaded before calling updateConsents

✅ Check browser console for JavaScript errors

✅ Make sure the object keys match the expected structure

🧪 Input Format Issues

Ventrata automatically converts various types to booleans:

window.Ventrata.updateConsents({
analytics_storage: "true", // → true
ad_storage: 1, // → true
security_storage: "1", // → true
personalization_storage: null, // → false
functionality_storage: "0" // → false
});
Did this answer your question?