AB Tasty + DataGrail Consent
AB Tasty provides native consent management with multiple detection methods, two operational modes, and configurable campaign behavior. This guide shows you how to configure AB Tasty to detect DataGrail's consent state.
Recommended Approach
Use AB Tasty's JavaScript-based detection method with a custom function that reads DataGrail's consent state via the DG_BANNER_API. This approach uses DataGrail's callback system as the source of truth for consent.
Configuration Steps
Configure Consent Management
In your AB Tasty dashboard:
- Navigate to Settings > Privacy & Data Collection
- Under Consent Management, select AB Tasty-managed
- Choose JavaScript-based as your detection method
- Add the custom consent detection function (see below)
- Select your preferred operational mode (Default or Strict)
Configure Consent Detection
Add this custom function in AB Tasty's JavaScript-based detection field. It reads DataGrail's consent state via the DG_BANNER_API:
function checkDataGrailConsent() {
if (window.DG_BANNER_API) {
return window.DG_BANNER_API.categoryEnabled('performance');
}
return false;
}
window.abtasty = window.abtasty || {};
window.abtasty.consentCheck = checkDataGrailConsent;
AB Tasty calls this function to determine whether to enable tracking. It returns true when Performance consent has been granted via the DataGrail banner, and false otherwise.
Choose Operational Mode
AB Tasty offers two operational modes:
| Mode | Tag Executes? | Data Collected Before Consent? | Campaign Behavior |
|---|---|---|---|
| Default (recommended) | Yes | No | Tag runs, no collection until consent |
| Strict | No | No | Tag blocked entirely until consent |
Recommended: Use Default mode for better user experience — campaigns can display variants immediately, but data collection waits for consent.
Cookie and Storage Patterns
Add these patterns as cookie rules in your DataGrail Consent dashboard under Cookie Management. For each pattern, select Add Rule, enter the match criteria, set the Category to Performance, and configure the appropriate retention:
| Match Criteria | Category | Retention | Purpose |
|---|---|---|---|
ABTasty | Performance | 400 days | Visitor ID, campaign history, allocation |
ABTastySession | Performance | Session | Session data, referrer |
ABTastyOptout | Performance | 400 days | Opt-out flag |
AB Tasty performs microsecond cookie validation tests — creating and immediately deleting ABTastyDomainTest cookies. Cookie scanners may detect these "ghost cookies." Set your scanner's lifetime threshold filter to exclude cookies that exist for less than 1 second.
Campaign Behavior Without Consent
Different AB Tasty campaign types behave differently when consent is not granted:
| Campaign Type | Without Consent | Reasoning |
|---|---|---|
| Test campaigns | Show original only | Data needed for valid comparison |
| Personalization | Can show personalized content | Functional experience, no tracking |
| Patch campaigns | Can display | UI fixes, no data collection |
This allows AB Tasty to deliver functional improvements while keeping behavioral measurement gated behind consent.
DataGrail Callback Integration
You can also coordinate consent using DataGrail's callback system:
<script>
window.dgEvent = window.dgEvent || [];
function handleAbTastyConsent(preferences) {
if (window.DG_BANNER_API.categoryEnabled('performance') && window.ABTasty) {
console.log('Performance consent granted - AB Tasty tracking enabled');
} else {
console.log('Performance consent denied - AB Tasty tracking disabled');
}
}
window.dgEvent.push({
event: "initial_preference_callback",
params: handleAbTastyConsent
});
window.dgEvent.push({
event: "preference_callback",
params: handleAbTastyConsent
});
</script>
Server-Side SDK
If you're using AB Tasty's Feature Experimentation SDK on the server:
// Node.js example
client.withVisitorConsent = false; // User declined consent
// Behavior:
// - Hit sent to AB Tasty indicating declined consent
// - Technical data still flows (campaign metadata)
// - Campaigns STILL delivered (functional experience preserved)
// - Behavioral data collection blocked
This server-side approach maintains functional delivery while respecting consent for measurement.
CMP Integration Options
AB Tasty also supports these CMPs if you use multiple consent tools:
- Didomi — Select "AB Tasty 2.0" as vendor in Didomi dashboard
- OneTrust — Use custom JavaScript reading
OnetrustActiveGroups - DataGrail — Use specific cookie detection or JavaScript-based method
Domain Delegation (Advanced)
For better performance and to avoid ad-blockers, you can host AB Tasty's script on your own subdomain:
Standard: https://try.abtasty.com/ACCOUNT_ID.js
Delegated: https://tasty.yourdomain.com/ACCOUNT_ID.js
Domain delegation makes AB Tasty cookies first-party and improves Safari ITP compatibility. Configure in AB Tasty dashboard under Domain Settings.
Troubleshooting
AB Tasty tracking continues after consent is denied
Check that:
- You've selected AB Tasty-managed consent (not "No consent verification")
- Your consent cookie detection is configured correctly
- The cookie name and match logic are accurate
- You're testing with cleared cookies (not cached consent state)
- You've selected Default or Strict mode (not disabled)
Test campaigns don't display variants even with consent
This usually means:
- Consent detection is returning false even when granted
- Check your detection function with
console.logdebugging - Verify the DataGrail consent cookie exists and has the expected value
- Ensure your AB Tasty account has active campaigns
- Check AB Tasty Preview mode to verify campaign targeting
Cookie scanner shows ABTastyDomainTest even when blocking cookies
This is expected — AB Tasty's domain validation creates and deletes cookies within milliseconds. Configure your scanner's lifetime threshold to filter cookies with duration < 1 second. These "ghost cookies" are validation checks, not persistent storage.
Personalization shows variants but test campaigns show original
This is correct behavior without consent:
- Personalization campaigns can deliver custom content (functional)
- Test campaigns show original to avoid biasing results
- This is AB Tasty's design — measurement requires consent, but functional delivery doesn't
Consent Mode Comparison
| Configuration Method | Setup Complexity | Maintenance | Flexibility |
|---|---|---|---|
| Specific cookie detection (recommended) | Low | Low (dashboard-only) | Medium |
| JavaScript-based | Medium | Medium (requires code) | High |
| Third-party CMP (TMS/GTM) | High | High (tag manager config) | High |
| Didomi native | Low | Low (Didomi manages) | Low |
Related Resources
- AB Tasty Consent Management Documentation
- DataGrail Consent Banner Documentation
- For questions, contact support@datagrail.io
Disclaimer: The information contained in this message does not constitute as legal advice. We would advise seeking professional counsel before acting on or interpreting any material.