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:

  1. Detects if a CMP is present
  2. Listens for consent changes
  3. Queues events while CMP UI is shown
  4. Releases/discards events based on consent decision
// No configuration needed - automatic detection
alkeAnalytics.setConfig({
    propertyId: 'your-property-uuid'
});
PurposeIDDescription
Store/access information1Required for cookies (userId, sessionId)
Measure advertising7Ad creative tracking
Understand audiences9Analytics and segmentation
Develop/improve services10Performance metrics

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:

  • null fallback → 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):

  1. Events are queued (not dropped)
  2. After 30 seconds without decision, queued events are sent with partial data
  3. When consent is given, queued events are sent with full data
  4. 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.