How to: send cookie consent to Omnisend
Intro
Omnisend features like forms, browse tracking, and marketing automation rely on cookie consent to operate in compliance with privacy regulations. If your website uses a Consent Management Platform (CMP), you need to pass the visitor's consent choices to Omnisend so it can activate or restrict features accordingly.
Use the Omnisend Cookie Consent API to send consent signals from your CMP. This guide covers integration with the following CMPs:
ImportantAll integration scripts in this guide depend on the Omnisend Javascript snippet (inShop). The snippet exposes
__omnisendCookieConsentonwindowand must be loaded before the CMP integration script runs — otherwisegetConsentAPI()is not defined.If you already connected your store with Omnisend, the snippet is already installed. Make sure the CMP integration script is placed after it on the page (or fires later via GTM).
How to deploy
Each CMP section below provides an integration script. Choose the deployment method that fits your setup:
Via Google Tag Manager
- Open your GTM container and go to Tags > New
- Click Tag Configuration and choose Custom HTML
- Paste the integration script for your CMP
- Click Triggering and add the All Pages trigger
- Save the tag and Publish the container
Custom script (without GTM)
Add the integration script for your CMP directly to your website before the closing </body> tag, on all pages where the Omnisend snippet is installed.
CookieYes
CookieYes exposes consent via the getCkyConsent() function and fires cookieyes_banner_load and cookieyes_consent_update events on the document.
The script below waits for the Omnisend Cookie Consent API to become available, forwards any stored consent decision when the banner loads, and re-forwards whenever the visitor updates their preferences.
Category mapping
| Omnisend | CookieYes |
|---|---|
| analytics | analytics, performance |
| marketing | advertisement |
| preferences | functional |
<script>
// Forwards CookieYes consent choices to Omnisend on page load and on banner interaction.
(async function () {
var api = await __omnisendCookieConsent.getConsentAPI({ wait: true });
function forwardConsent() {
if (typeof window.getCkyConsent !== "function") return;
var c = (window.getCkyConsent().categories) || {};
api.consentManager.setConsent({
necessary: true,
analytics: !!(c.analytics || c.performance),
marketing: !!c.advertisement,
preferences: !!c.functional
});
}
document.addEventListener("cookieyes_banner_load", function () {
if (window.getCkyConsent && getCkyConsent().isUserActionCompleted) forwardConsent();
});
document.addEventListener("cookieyes_consent_update", forwardConsent);
})();
</script>Cookiebot
Cookiebot (Usercentrics) exposes consent via the Cookiebot.consent object and fires CookiebotOnAccept and CookiebotOnDecline events when the visitor interacts with the banner.
Category mapping
| Omnisend | Cookiebot |
|---|---|
| analytics | statistics |
| marketing | marketing |
| preferences | preferences |
The script below waits for the Omnisend Cookie Consent API to become available, forwards any stored consent decision on page load, and re-forwards whenever the visitor updates their preferences.
<script>
// Forwards Cookiebot consent choices to Omnisend on page load and on banner interaction.
(async function () {
var api = await __omnisendCookieConsent.getConsentAPI({ wait: true });
function forwardConsent() {
var consent = window.Cookiebot && window.Cookiebot.consent;
if (!consent) return;
api.consentManager.setConsent({
necessary: true,
analytics: !!consent.statistics,
marketing: !!consent.marketing,
preferences: !!consent.preferences
});
}
forwardConsent();
window.addEventListener("CookiebotOnAccept", forwardConsent);
window.addEventListener("CookiebotOnDecline", forwardConsent);
})();
</script>Complianz
Complianz exposes consent via the cmplz_has_consent() function and fires cmplz_status_change, cmplz_enable_category, and cmplz_revoke events on the document.
The script below waits for the Omnisend Cookie Consent API to become available, forwards any stored consent decision on page load, and re-forwards whenever the visitor updates their preferences.
Category mapping
| Omnisend | Complianz |
|---|---|
| analytics | statistics |
| marketing | marketing |
| preferences | preferences |
<script>
// Forwards Complianz consent choices to Omnisend on page load and on banner interaction.
(async function () {
var api = await __omnisendCookieConsent.getConsentAPI({ wait: true });
function forwardConsent() {
if (typeof window.cmplz_has_consent !== "function") return;
api.consentManager.setConsent({
necessary: true,
analytics: !!cmplz_has_consent("statistics"),
marketing: !!cmplz_has_consent("marketing"),
preferences: !!cmplz_has_consent("preferences")
});
}
forwardConsent();
document.addEventListener("cmplz_status_change", forwardConsent);
document.addEventListener("cmplz_enable_category", forwardConsent);
document.addEventListener("cmplz_revoke", forwardConsent);
})();
</script>Updated 2 days ago