window.CookieChimp (or its CSS variables) from your own JavaScript or CSS to tweak the banner that’s already been served. Common reasons to do this include:
- Hiding or showing a UI element on the banner for visitors from one country only.
- Tagging your own analytics or CRM events with the consent mode that was applied, for internal reporting.
- Giving the banner different branding on each of your domains while sharing a single CookieChimp account.
window.CookieChimp or the current page.
What properties are available?
These are the most commonly used properties in the recipes below. For the complete client-side reference — every property, event, and method — see the JavaScript SDK.CookieChimp.visitorCountry
The ISO 3166-1 alpha-2 country code of the visitor (e.g. "US", "GB", "CN", "DE").
CookieChimp.visitorRegion
The region/subdivision code of the visitor (e.g. "NY" for New York, "CA" for California). Useful when compliance rules differ by region within a country — for example, US state privacy laws.
CookieChimp.visitorNeedsConsent
true if a consent banner was shown to the visitor (either an opt-in or opt-out banner), false if the visitor's location does not require one.
CookieChimp.getConfig()['mode']
Returns the consent mode that was applied to the visitor based on your geolocation rules:
"opt-in"— the visitor was shown an opt-in banner (e.g. EU/EEA visitors under GDPR)."opt-out"— the visitor was shown an opt-out banner (e.g. US visitors under CCPA-style regulations).
Example: hide the close button for one country
Some jurisdictions treat a close (×) button as an ambiguous signal — a visitor who dismisses the banner without an explicit accept or reject hasn’t made a clear consent choice, and regulators may not consider that a valid interaction. If your default banner shows a close button, the cleanest fix is to hide it — but only for visitors from those countries, so the easier dismissal flow is preserved elsewhere.
You can keep a single banner and toggle the close button visibility with a small CSS rule that’s only applied when visitorCountry matches.
Option 1 — Inject a style tag
Option 2 — Toggle a class on <html> and scope the CSS
Example: tag your own analytics with the visitor’s consent mode
CookieChimp already handles tag-firing correctly for both opt-in and opt-out banners out of the box — opt-out banners fire analytics natively without waiting for consent, and Google Consent Mode is wired up automatically. You don’t need to write code for that. What you may want to do is segment your own product analytics by consent mode so you can build internal dashboards — for example, comparing engagement between visitors who saw an opt-in banner vs. an opt-out banner, or tracking consent rates by country for compliance reporting.window.analytics.identify for whichever analytics or CDP SDK you use (Segment, Amplitude, Mixpanel, PostHog, etc.). Once these properties are attached to the visitor, every downstream event can be filtered or grouped by consent mode and region.
Example: per-domain branding when sharing one account
If you run multiple domains from a single CookieChimp account — for example, a brand and its regional subsidiaries — you can keep one set of categories, vendor lists, and consent records, while still giving each domain its own banner colours. The dashboard sets the global theme; a tiny CSS override on each domain swaps the variables that need to differ. Add the override directly in each site’s stylesheet (or inject it from your tag manager):location.hostname:
When should I override vs. configure another banner?
Configure a separate banner in the dashboard (via geolocation rules) when:- You want different banner text, design, or configuration for a region — each banner has its own copy, styling, and consent mode (opt-in or opt-out), with translations built in.
- The applied consent mode needs to differ between regions — CookieChimp surfaces the applied mode via
getConfig().mode.
- The banner content is the same across regions, but you need a small UI tweak, a per-domain colour change, or different tag-firing behaviour for one segment.
- You want to keep a single source of truth for banner content and avoid maintaining duplicates just to flip one CSS rule or push one event.
- Enable Debug mode from the CookieChimp dashboard and check the browser JS console for errors.
If you encounter any issues or need further assistance, please reach out to us via our chat.