Consent Management
Implement GDPR-compliant tracking with IAB TCF 2.0 support.
Overview
Alke Analytics is designed for privacy compliance. The SDK:
- Reads consent status from your CMP (Consent Management Platform)
- Adapts data collection based on user choices
How It Works
The SDK automatically listens for the IAB TCF 2.0 __tcfapi:
- Detects if a CMP is present
- Listens for consent changes
- Queues events while CMP UI is shown
- Releases/discards events based on consent decision
// No configuration needed - automatic detection
alkeAnalytics.setConfig({
propertyId: 'your-property-uuid'
});
Consent Purposes Used
| Purpose | ID | Description |
|---|---|---|
| Store/access information | 1 | Required for cookies (userId, sessionId) |
| Measure advertising | 7 | Ad creative tracking |
| Understand audiences | 9 | Analytics and segmentation |
| Develop/improve services | 10 | Performance metrics |
Consent-Wrapped Data (Web)
Wrap sensitive values so they’re only sent with consent:
// holdUntilConsent(value, fallback, purposes)
// Email only sent with purpose 1 consent
alkeAnalytics.setCustomData(1,
alkeAnalytics.holdUntilConsent(userEmail, null, [1])
);
// User ID with anonymous fallback
alkeAnalytics.setCustomData(2,
alkeAnalytics.holdUntilConsent(userId, "anonymous", [1, 9])
);
If consent is not granted:
nullfallback → dimension not sent- String fallback → fallback value sent
Blocking Tracking (Web)
Allow users to opt-out completely, regardless of CMP:
// Permanently block tracking (sets cookie for 13 months)
alkeAnalytics.blockTracking();
// Re-enable tracking
alkeAnalytics.unblockTracking();
This sets a alke_no_tracking cookie that persists across sessions.
Event Queuing
When a CMP UI is displayed (consent not yet given):
- Events are queued (not dropped)
- After 30 seconds without decision, queued events are sent with partial data
- When consent is given, queued events are sent with full data
- When consent is refused, sensitive fields are stripped
No Data Loss
Pageviews are never lost. If consent is refused, they’re sent without consent-dependent fields (user ID, UTM parameters, etc.).
CMP Compatibility
The SDK works with any IAB TCF 2.0 compliant CMP, including:
- AppConsent
- Cookiebot
- Didomi
- OneTrust
- Quantcast Choice
- Sourcepoint
- TrustArc
CMP Validation
The SDK validates the CMP ID against the official IAB vendor list. Unregistered CMPs are ignored.