⚠️ Important Legal Notice: Making these customizations will render Osano's "No Fines, No Penalties" guarantee null and void.

Hide Banner for US Users

This page demonstrates how to use Osano's built-in jurisdiction detection to hide the Osano consent banner exclusively for users in the United States. US users will not see the banner at all, while users in all other countries will see the standard Osano banner.

The implementation uses Osano's jurisdiction detection to identify US users and applies inline CSS to completely hide the banner for them.

To implement this, you need two parts:

1. Load the Osano Script

First, add the Osano script to your page (replace with your actual account and customer IDs):

<script src="https://cmp.osano.com/YOUR_ACCOUNT_ID/YOUR_CUSTOMER_ID/osano.js"></script>

2. JavaScript to Hide Banner for US Users

Add the following script to your page after the Osano script tag:

<script> // Hide banner for US users when Osano initializes window.Osano?.cm?.addEventListener('osano-cm-initialized', () => { if (window.Osano.cm.jurisdiction?.startsWith('us-')) { const banner = document.querySelector('.osano-cm-dialog'); banner.style.display = 'none'; } }); </script>
⚠️ Implementation Note: The JavaScript script must be loaded after the Osano script tag to ensure Osano is available when the script runs. No additional CSS is required - the banner hiding is handled entirely through JavaScript.
⚠️ Critical Osano Setting Required: You must enable the "US State Level Legislation Opt-Out Banner Format" toggle in your Osano dashboard for this customization to work properly. Without this setting enabled, users in states that default to banner 3 (like California, Colorado, Texas, etc.) will never have the opportunity to opt in, and they won't automatically be opted in like the rest of the US. This setting ensures all US users see the same banner format that can be hidden by this script.

Implementation Details & Best Practices

This implementation uses Osano's built-in jurisdiction detection to identify US users and applies CSS to completely hide the consent banner for them. The approach is simple, reliable, and doesn't require external APIs.

Key Benefits:

Important Considerations:

Open Cookie Preferences