How to Run Cookie Banners Only in Certain States (and Hide Them Everywhere Else)
Sep 5, 2025
Tyler Zey
What We're Building
When configuring a cookie banner, you'll frequently need vastly different settings based on your visitors' region. Different jurisdictions have different requirements—some typically require explicit opt-in consent, while others often allow more flexible approaches.
This guide demonstrates how to configure the Ours Privacy CMP solution to handle these regional differences automatically.
Our Example Configuration
We'll build a cookie banner with two distinct behaviors:
In California (CA): Shows the cookie banner, typically requires users to opt-in, and can disable page interaction until consent is given
All Other States: Hides the cookie banner by default (users can open it via a footer link) and defaults to opt-out mode
This configuration shows how you can mix automatic enforcement in one jurisdiction with a more passive approach elsewhere.
The CDP Advantage
For both configurations, we'll use the Ours Privacy CDP to send data and analytics to Google Ads and Google Analytics without loading third-party scripts on your website. Ours Privacy collects data server-side and sends it to third parties, which can help support privacy-compliant data practices.
Important Disclaimer: This guide demonstrates how you can configure Ours Privacy and is for example purposes only. It is not legal advice and does not constitute a recommendation for how you should configure your privacy setup. Regulatory requirements vary by jurisdiction and may change over time. Always consult your own legal counsel and privacy officers when determining compliance strategies for your organization. Ours Privacy makes no guarantees about compliance with any specific regulations.
Implementation Steps
Step 1: Set Default CMP Mode
Configure the CMP defaults to opt-out with no UI shown.
This ensures that in all states other than California, visitors are opted out by default and don’t see a banner unless they manually open it.

Step 2: Add a Custom Rule for California
Create a state-specific configuration for California:
Mode: Opt-in
Auto-show: Enabled
Page Interactions: Disabled until consent is given

Step 3: Implement the CMP Footer Link
For states running in default opt-out mode, provide a way for users to open the CMP manually.
Example using the OursPrivacy Web SDK:

Step 4: Verify Behavior and Dispatch To Google Analytics & Google Ads
Navigate from a California IP → CMP auto-shows in opt-in mode.
Navigate from another state → No banner appears, but the footer link opens the CMP on click.

Wrapping Up
This example demonstrates how to use the OursPrivacy CMP to apply different consent strategies across jurisdictions. In reality, your configuration may be more complex, with multiple states or countries requiring unique approaches. This walkthrough is a starting point for building flexible, rule-driven consent flows—always consult with your legal team to ensure your approach meets your specific compliance requirements.