Testing your setup
Use non-production environments, simulated regions, and browser tools to verify that blocking, consent mode, and regional rules work as expected before publishing to production.
Last updated:
Before publishing a banner to production, verify that blocking, consent signals, and regional behavior work as expected. CookieBeam's environment system and the browser's developer tools give you everything you need.
Use environments for safe testing
If your plan includes environments, create a dev or staging environment for your banner. Each environment gets its own CDN URL and its own published configuration, so you can test changes without affecting production visitors.
- Open the banner and go to Environments.
- Create a dev environment if you don't have one.
- Publish your changes to the dev environment.
- Load the dev environment's script URL on your test site or local dev server.
Changes published to a dev environment don't touch the production default/ CDN path. When you're satisfied, promote from dev to staging to production, or publish directly to production.
If you don't use environments, test in a private browser window against your production banner. The techniques below work either way.
Verify blocking
Open your site in a clean browser profile (no stored consent cookie) with DevTools open.
- Open the Network panel and filter by script type (JS). Load the page.
- Check that non-necessary scripts don't fire. Scripts in categories like
analyticsandmarketingshould not appear in the network log before you interact with the banner. If they do, the script may be missing adata-categoryattribute or may not be in the scan inventory. - Accept consent. Click "Accept all" on the banner.
- Confirm blocked scripts now load. The network panel should show the previously blocked scripts loading. Check that they execute in the right order; a tag manager should load before the tags it injects.
- Revoke consent. Open the preferences panel (through the floating settings button or
CookieBeam.showPreferences()), uncheck a category, and save. - Reload the page. Confirm that scripts in the revoked category don't fire.
- Check autoClear. If you configured
autoClearon a category, open DevTools Application > Cookies after revoking that category. The cookies listed in the autoClear configuration should be gone.
Manual script gating
If you gate scripts with type="text/plain" and data-category in your HTML, check each one:
<script type="text/plain" data-category="marketing" data-src="https://example.com/pixel.js"></script>
- Before consent: the element should have
type="text/plain"and the script should not execute. - After accepting marketing: a new script element should appear in the DOM with the real
src, and the network panel should show the request.
Verify Google Consent Mode
If you enabled Consent Mode v2, check that the gtag calls fire at the right time.
- Open the Console in DevTools. Optionally add a breakpoint or log observer on
gtagto capture calls. - Load the page in a clean profile. Look for the
consent defaultcall. You should see all keys set; most todenied(in an opt-in region); pluswait_for_update. - Accept consent. Look for the
consent updatecall. The keys for accepted categories should now begranted. - Check the consent cookie. Open Application > Cookies, find
cb_cookie, and decode its value (URL-decode, then parse as JSON). TheconsentModefield should contain astateobject mirroring what you saw in theupdatecall.
If you use Google Tag Manager, install the Google Tag Assistant Chrome extension. It shows a timeline of consent state changes and flags tags that fired before consent was resolved.
What to check in the consent cookie
{
"consentMode": {
"v": 1,
"revision": 3,
"expiresAt": 1747123456000,
"state": {
"ad_storage": "granted",
"analytics_storage": "granted",
"security_storage": "granted"
}
}
}
vshould be1(the current contract version).stateshould reflect the visitor's actual category choices, mapped through the category-to-key configuration.revisionshould match your banner's current revision.expiresAtshould be a future timestamp.
Test regional rules
Regional rules change the banner's consent model, buttons, and text per visitor location. Testing them requires simulating different geolocations.
In the dashboard preview
The banner preview in Dashboard → Banners → your banner → Preview lets you pick a simulated country and region. Use it to check each rule without leaving your desk:
- For an EU country, the banner should show in opt-in mode with "Accept all" and "Reject all" buttons.
- For California, the banner should show in opt-out mode, possibly with a "Do Not Sell or Share" link.
- For a country not covered by any rule, the fallback should apply; check whether the banner shows or hides, and which consent model it uses.
On a live page
To test on your actual site:
- VPN or proxy: connect from the target country. The CDN edge reads the visitor's IP to resolve the country.
- Geo-override header: if your CDN supports it, set the override header in your request. This depends on your setup.
For each region, verify:
- The correct consent model is active (check the banner's buttons).
- The banner text matches the regional rule's translation overrides, if any.
- The consent record's
collectedViaandacceptTypematch the expected behavior.
Test the fallback
Use a country that no rule covers (try a small nation not in your rule set). The fallback settings should apply: the banner either shows with the fallback consent model, or it hides and grants the fallback's defaultCategories plus readOnly categories (see Regional rules).
Verify privacy signals
To test Global Privacy Control:
- Enable the signal. Use a browser extension that sets
navigator.globalPrivacyControl = true, or enable the GPC flag in your browser's privacy settings (Firefox: Settings > Privacy & Security > "Tell websites not to sell or share my data"). The property is read-only in most browsers, so assigning it from the Console does not work. - Load the page in a clean profile.
- In
hard_optoutmode: the banner should not auto-show. A toast may appear saying the GPC preference was respected. Open the consent cookie and check forgpcRespected: true. - In
preselect_denymode: the banner should show, but the signal-covered categories should be pre-deselected (unchecked). The visitor can still adjust and save. - Without the signal: repeat the test with GPC off. The banner should behave normally, and
gpcRespectedshould not appear on the consent record.
Check the consent record
After each test, inspect the stored consent record to confirm it matches expectations.
In DevTools
- Open Application > Cookies and find
cb_cookieon your site's domain. - Copy the value and URL-decode it (the browser's console:
decodeURIComponent('...')). - Parse the result as JSON.
Key fields to check:
| Field | What to look for |
|---|---|
categories | The list of accepted category IDs |
acceptType | all, necessary, or custom: matches the button the visitor clicked |
collectedVia | banner, preferences, api, or a machine value like default_optout |
isDefaultState | true for machine-written records, absent or false for explicit choices |
isPending | true on opt-in default records (nothing non-necessary granted). Also set on opt-out, notice, and hidden-region defaults when Consent Mode's deferMachineDefaults is on |
gpcRespected | true when GPC shaped the record |
revision | Should match the banner's published revision number |
Using the Browser API
Instead of reading the cookie directly, use CookieBeam's JavaScript API in the Console:
// Check if a specific category is accepted
CookieBeam.acceptedCategory('analytics'); // true or false
// Get the full preferences object
CookieBeam.getUserPreferences();
// { acceptedCategories: ['necessary', 'analytics', ...],
// rejectedCategories: ['marketing', ...],
// acceptedServices: { analytics: ['Google Analytics'] },
// rejectedServices: { ... } }
See Browser API for the full method list.
Common issues
The banner doesn't show.
- Check that
autoShowis notfalsein your configuration. - Check the visitor's regional rule. If
showBannerisfalse, the banner is hidden for that region and the rule'sdefaultCategoriesplusreadOnlycategories are auto-granted (see What hiding the banner grants). - Clear the consent cookie. An existing valid cookie suppresses the banner.
- Check the Console for errors. A misconfigured translation or missing required field can prevent rendering.
A script still fires after the visitor rejected its category.
- Verify the script has
data-categoryset to the right category ID, or that it's in the scan inventory under the right category. - Scripts hardcoded with
<script src="...">in your HTML (notype="text/plain") execute before CookieBeam can intercept them. Change them to the manual gating pattern. - Check for a tag manager that loads the script outside CookieBeam's control.
Google Consent Mode isn't firing.
- Check that
consentMode.enabledistruein the banner configuration. - Check that
setDefaultsOnLoadistrue(it is by default). Iffalse, theconsent defaultcall won't fire. - Make sure the CookieBeam script loads before
gtag.js. Consent Mode defaults must be set before Google tags initialize.
Wrong region detected.
- The region comes from the CDN edge, which reads the visitor's IP. A VPN or corporate proxy can cause a mismatch.
- In the dashboard preview, make sure you selected the right simulated country.
- Check the console for CookieBeam's regional match logging (available in non-production builds).
Consent cookie not appearing.
- Check the cookie's domain setting. If set to
.example.com, it won't appear when testing onlocalhost. - Some browsers block cookies in certain privacy modes. Try a standard private window.
- Check for cookie size. The consent cookie can grow large with many services and the consentMode snapshot. Browsers reject cookies over 4 KB.