To capture valuable insights while protecting user privacy, you need to collect consent from your website users. We recommend you use a Consent management platform (CMP) or work with your content management system (CMS) to collect consent and send it to Google.
Learn more about how to Set up your consent banner with a consent management platform or a content management system.
Configure your banner
- Sign up at CookieHub.
- Configure your banner using the 'Getting started' wizard.
- Be sure your banner complies with the requirements in the Google EU user consent policy (EUUCP).
For more details on CookieHub banner setup, read this article.
Add the banner to your site
After you’ve installed your consent banner, you'll need to enable consent mode.
Set up using Google Tag Manager
- Open Google Tag Manager and navigate to your container.
- In Tags, click New.
- Name the tag.
- Click Tag configuration.
- Click Discover more tag types in the Community Template Gallery.
- Search for 'CookieHub CMP by cookiehub-com'
- Add your CookieHub domain code from the CookieHub console to configure the template.
- Configure the default settings that you’d like to use under 'Consent mode settings'. Add a row for global settings with regions blank and add additional rows for region-specific settings using comma-separated ISO 3166-2 country codes in the Region box.
- Click Add.
- Click Triggering.
- Select Consent initialisation – All pages.
- Click Save.
- Test your container by clicking Preview in the top right-hand corner (see instructions for testing below).
- Publish your container.
Set up using another platform or directly from your website’s code
- In the CookieHub UI, navigate to the 'Implementation' tab under Cookie banner code and click Manually insert the code to receive a CMP code snippet.
- If you use a website builder, review their documentation to find out how to implement code in the head tag of each page. Otherwise, skip to Step 3.
- In the head tag of each page, paste the following code followed by the CMP script that you copied in Step 1 at the top of the head tag.Note: This ensures that the CMP functions properly.
<script>
// Define dataLayer and the gtag function.
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
// Set default consent for specific regions according to your requirements
gtag('consent', 'default', {
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'analytics_storage': 'denied',
'regions':[<list of ISO 3166-2 region codes>]
});
// Set default consent for all other regions according to your requirements
gtag('consent', 'default', {
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'analytics_storage': 'denied'
});
</script>
<!-- PASTE YOUR COOKIEHUB CMP CODE SNIPPET HERE -- >
After you’ve enabled your consent banner, consent mode is enabled automatically.
Testing using Tag Assistant
Learn more about how to Troubleshoot consent mode with Google Tag Manager.