Skip to main content

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.

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

In your AB Tasty dashboard:

  1. Navigate to Settings > Privacy & Data Collection
  2. Under Consent Management, select AB Tasty-managed
  3. Choose JavaScript-based as your detection method
  4. Add the custom consent detection function (see below)
  5. Select your preferred operational mode (Default or Strict)

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:

ModeTag Executes?Data Collected Before Consent?Campaign Behavior
Default (recommended)YesNoTag runs, no collection until consent
StrictNoNoTag blocked entirely until consent

Recommended: Use Default mode for better user experience — campaigns can display variants immediately, but data collection waits for consent.

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 CriteriaCategoryRetentionPurpose
ABTastyPerformance400 daysVisitor ID, campaign history, allocation
ABTastySessionPerformanceSessionSession data, referrer
ABTastyOptoutPerformance400 daysOpt-out flag
Ghost Cookies

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.

Different AB Tasty campaign types behave differently when consent is not granted:

Campaign TypeWithout ConsentReasoning
Test campaignsShow original onlyData needed for valid comparison
PersonalizationCan show personalized contentFunctional experience, no tracking
Patch campaignsCan displayUI 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.log debugging
  • 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
Configuration MethodSetup ComplexityMaintenanceFlexibility
Specific cookie detection (recommended)LowLow (dashboard-only)Medium
JavaScript-basedMediumMedium (requires code)High
Third-party CMP (TMS/GTM)HighHigh (tag manager config)High
Didomi nativeLowLow (Didomi manages)Low

 

Need help?
If you have any questions, please reach out to your dedicated Account Manager or contact us at 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.