OneTrust integration
Custom connection between OneTrust & AB Tasty
Configuration in AB Tasty Platform
You can configure OneTrust consent management directly within the AB Tasty platform through the Settings > Privacy > Manage Visitor Consent section using the JavaScript option.
Accessing the Configuration
Navigate to Settings in your AB Tasty dashboard
Go to Privacy section
Select Manage Visitor Consent
Choose JavaScript option for custom consent implementation
OneTrust Group ID Checking
Legacy Implementation
For older OneTrust implementations:
javascriptUnwrapCopyreturn typeof window.OnetrustActiveGroups !== 'undefined' &&
window.OnetrustActiveGroups.includes('C0002') &&
window.OnetrustActiveGroups.includes('C0003');
Current Implementation
For recent OneTrust implementations that return comma-delimited strings:
javascriptUnwrapCopy// Check for Analytics consent (group 2)
return typeof OnetrustActiveGroups !== 'undefined' &&
OnetrustActiveGroups.includes(',2,');
// Check for Marketing consent (group 4)
return typeof OnetrustActiveGroups !== 'undefined' &&
OnetrustActiveGroups.includes(',4,');
Using .includes(',2,')
prevents false positives (e.g., matching group 12 when checking for group 2).
Platform Configuration Details
JavaScript Consent Function Setup
In the AB Tasty privacy settings, you'll need to configure a JavaScript function that returns true
when consent is granted and false
when it's not. This function will be called by AB Tasty to determine whether to:
Activate campaigns
Collect visitor data
Set tracking cookies
Configuration Options
javascriptUnwrapCopy// Simple consent check for analytics
function() {
return typeof OnetrustActiveGroups !== 'undefined' &&
OnetrustActiveGroups.includes(',2,');
}
Advanced Configuration Features
Consent Monitoring
The platform automatically monitors consent changes and will:
Start campaigns when consent is granted
Stop data collection when consent is withdrawn
Resume tracking when consent is re-granted
Campaign Behavior Options
You can configure how campaigns behave based on consent status:
Wait for Consent: Campaigns don't start until consent is given
Show Without Tracking: Campaigns run but no data is collected until consent
Conditional Activation: Different campaigns activate based on specific consent categories
Testing Your Configuration
In AB Tasty Platform
Use the Preview Mode to test consent scenarios
Check the Browser Console for consent-related logs
Verify campaign activation in different consent states
Browser Testing
javascriptUnwrapCopy// Test consent status in browser console
console.log('OneTrust Groups:', OnetrustActiveGroups);
console.log('Analytics Consent:', OnetrustActiveGroups.includes(',2,'));
console.log('Marketing Consent:', OnetrustActiveGroups.includes(',4,'));
Common OneTrust Group Mappings
,1,
Strictly Necessary
Essential website functionality
,2,
Performance/Analytics
Website analytics and performance
,3,
Functional
Enhanced website features
,4,
Targeting/Marketing
Advertising and marketing cookies
Best Practices for Platform Configuration
1. Start Simple
Begin with a basic consent check and gradually add complexity:
javascriptUnwrapCopy// Start with this
return typeof OnetrustActiveGroups !== 'undefined' &&
OnetrustActiveGroups.includes(',2,');
2. Add Error Handling
javascriptUnwrapCopyfunction() {
try {
return typeof OnetrustActiveGroups !== 'undefined' &&
OnetrustActiveGroups.includes(',2,');
} catch (error) {
console.error('Consent check error:', error);
return false; // Default to no consent on error
}
}
3. Log for Debugging
javascriptUnwrapCopyfunction() {
const hasConsent = typeof OnetrustActiveGroups !== 'undefined' &&
OnetrustActiveGroups.includes(',2,');
console.log('AB Tasty Consent Check:', {
groups: OnetrustActiveGroups,
hasConsent: hasConsent
});
return hasConsent;
}
Validation and Monitoring
After configuration, monitor your setup through:
AB Tasty Analytics Dashboard: Check visitor consent rates
Campaign Performance: Verify campaigns activate correctly
Browser Developer Tools: Monitor console logs for consent events
OneTrust Reports: Cross-reference consent data
This configuration ensures your AB Tasty implementation respects user privacy preferences while maintaining optimal testing capabilities within GDPR compliance requirements.
Last updated
Was this helpful?