Skip to content
Last updated: 2026-04-06
Reference

Consent Integration

Dxtra Tag Manager integrates with consent management platforms (CMPs) to ensure tags only execute when appropriate consent has been obtained.

Consent integration enables:

  • Automatic Consent Validation: Tags only execute with valid consent
  • CMP Check Event: Built-in event for consent-based rule triggering
  • Real-Time Updates: Consent changes immediately affect tag behavior
  • Consent Categories: Map tags to specific consent purposes

CMP Check Event

Use the CMP Check event to trigger rules based on consent status:

Text Only
Rule: "Marketing Pixel with Consent"
Event: CMP Check
Conditions:
  - Consent Purpose: "marketing" equals "true"
Actions:
  - Fire marketing pixel

CMP Check Event Properties

Property Description
purpose_analytics Analytics consent status
purpose_marketing Marketing consent status
purpose_personalization Personalization consent status
purpose_advertising Advertising consent status

Map tag types to appropriate consent categories:

Tag Type Consent Category Legal Basis
First-party analytics analytics Legitimate interest
Third-party analytics analytics Consent
Marketing pixels marketing Consent
Personalization personalization Consent
Advertising advertising Consent
Essential functionality None required Legitimate interest

Add consent conditions to rules:

JavaScript
// Rule configuration
Event: "Page Loaded"
Conditions:
  - Data Container: "CMP"
  - Key: "analytics_consent"
  - Operator: "Equals"
  - Value: "true"
Actions:
  - Execute analytics tag

Using Environment Variables

Configure consent requirements per environment:

JavaScript
// Access consent status in actions
const analyticsConsent = '{{CMP.analytics}}' === 'true';
const marketingConsent = '{{CMP.marketing}}' === 'true';

if (analyticsConsent) {
  // Fire analytics
}

if (marketingConsent) {
  // Fire marketing tags
}

TCF v2.0 Integration

Dxtra integrates with IAB TCF v2.0 compliant CMPs:

JavaScript
// Access TCF consent data
if (window.__tcfapi) {
  __tcfapi('getTCData', 2, function(tcData, success) {
    if (success && tcData.gdprApplies) {
      // Purpose consents
      const purpose1 = tcData.purpose.consents[1]; // Store/access device
      const purpose7 = tcData.purpose.consents[7]; // Measurement

      // Vendor consents (if needed)
      const vendorConsent = tcData.vendor.consents[YOUR_VENDOR_ID];
    }
  });
}

TCF Purpose Mapping

TCF Purpose Description Typical Use
Purpose 1 Store/access device info Essential tracking
Purpose 7 Measure ad performance Analytics
Purpose 8 Measure content performance Content analytics
Purpose 9 Apply market research Surveys, research
Purpose 10 Develop/improve products Product analytics

USP API Integration (CCPA)

For California Consumer Privacy Act compliance:

JavaScript
// Check US Privacy String
if (window.__uspapi) {
  __uspapi('getUSPData', 1, function(uspData, success) {
    if (success) {
      const uspString = uspData.uspString;
      // Format: 1YNN (Version, Notice, Opt-out, LSPA)
      const optedOut = uspString.charAt(2) === 'Y';

      if (optedOut) {
        // Honor opt-out preference
      }
    }
  });
}
JavaScript
// Action: Analytics Initialization
(function() {
  // Check consent before initializing
  const analyticsConsent = '{{CMP.analytics}}' === 'true';

  if (!analyticsConsent) {
    console.log('Analytics blocked - no consent');
    return;
  }

  // Initialize analytics
  gtag('config', 'GA_MEASUREMENT_ID');
})();
JavaScript
// Action: Marketing Pixel
(function() {
  const marketingConsent = '{{CMP.marketing}}' === 'true';

  if (!marketingConsent) {
    return; // Skip without consent
  }

  // Fire marketing pixel
  fbq('track', 'PageView');
})();

When consent changes, Dxtra can:

  1. Stop running tags that no longer have consent
  2. Start new tags that now have consent
  3. Update tag behavior based on new consent level
JavaScript
// Listen for consent changes
if (window.__tcfapi) {
  __tcfapi('addEventListener', 2, function(tcData, success) {
    if (success && tcData.eventStatus === 'useractioncomplete') {
      // User updated consent preferences
      // Tag Manager automatically re-evaluates rules
    }
  });
}

Best Practices

  • Set consent requirements at the rule level, not tag level
  • Use the CMP Check event for consent-dependent tags
  • Test consent flows in development environment first
  • Document consent mapping for compliance audits

Tag Organization

  • Group consent-requiring tags in separate rule groups
  • Use meaningful names indicating consent requirements
  • Create exception rules for consent-free fallbacks

Testing

  1. Test with consent granted: Verify tags fire correctly
  2. Test with consent denied: Verify tags are blocked
  3. Test consent change: Verify real-time updates work
  4. Test edge cases: Partial consent, expired consent

Troubleshooting

  1. Check CMP integration: Verify CMP is sending consent signals
  2. Verify condition syntax: Ensure consent condition matches CMP format
  3. Enable debug mode: Use #dxtra-debug to see consent status
  4. Check timing: Ensure CMP loads before Tag Manager evaluates rules
  1. Review rule conditions: Ensure consent check is required
  2. Check exception rules: Look for rules that bypass consent
  3. Verify CMP status: Confirm CMP is functioning correctly

Support

  • Privacy Documentation: Consent integration reference
  • CMP Setup Guides: Platform-specific CMP integration
  • Support Email: support@dxtra.ai (include "Consent Integration" in subject)

Continue to Privacy Features for comprehensive privacy and compliance features.