Skip to main content

Consent Mode

Implement GDPR-compliant tracking by respecting user consent choices.

Overview

edrone supports consent-based tracking:

  • Track users only after consent is given
  • Respect consent withdrawal
  • Integrate with common consent management platforms

Implementation

// Example with generic consent check
function hasMarketingConsent() {
// Replace with your consent platform's method
return getCookieConsent('marketing') === true;
}

// Only initialize edrone if consent given
if (hasMarketingConsent()) {
(function (appId) {
window._edrone = window._edrone || {};
_edrone.app_id = appId;
_edrone.platform = 'custom';
var doc = document.createElement('script');
doc.type = 'text/javascript';
doc.async = true;
doc.src = "https://d3bo67muzbfgtl.cloudfront.net/edrone_2_0.js?app_id=" + appId;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(doc, s);
})("YOUR_APP_ID");
}
// Initialize when consent is granted later
window.addEventListener('consentGranted', function(e) {
if (e.detail.marketing && !window._edrone) {
// Initialize edrone after consent
initializeEdrone();
}
});

CMP integrations

Cookiebot

window.addEventListener('CookiebotOnAccept', function() {
if (Cookiebot.consent.marketing) {
initializeEdrone();
}
});

OneTrust

function OptanonWrapper() {
if (OnetrustActiveGroups.includes('C0004')) { // Marketing category
initializeEdrone();
}
}

Usercentrics

window.addEventListener('ucEvent', function(e) {
if (e.detail.event === 'consent_status' && e.detail['Marketing'] === true) {
initializeEdrone();
}
});

If using Google Consent Mode:

// Set default consent
gtag('consent', 'default', {
'ad_storage': 'denied',
'analytics_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied'
});

// Update when consent given
function updateConsent() {
gtag('consent', 'update', {
'ad_storage': 'granted',
'analytics_storage': 'granted',
'ad_user_data': 'granted',
'ad_personalization': 'granted'
});

// Initialize edrone after consent
initializeEdrone();
}

Best practices

  1. Don't track before consent - wait for explicit user consent
  2. Handle consent withdrawal - stop tracking when consent is revoked
  3. Document your approach - update privacy policy accordingly
  4. Test thoroughly - verify tracking respects consent states