Umbraco cookie consent, added through custom code.
Add the CookieHub implementation code to your Umbraco master template to hold supported non-essential tracking until the relevant consent category is allowed, show a customizable cookie banner and keep records of visitor consent where consent records are enabled on your plan. No Umbraco package required.
- Custom code — no Umbraco package to install
- Added once in the template your pages share
- Placed right after the opening <head> tag
Why use CookieHub with Umbraco.
Umbraco gives developers full control over templates and server-rendered HTML. That flexibility also means analytics, marketing and embedded tools added through templates, partial views, macros or content can set cookies as soon as a page loads — before a visitor has made a choice.
CookieHub adds a central consent layer to your Umbraco site. It runs in the visitor’s browser, holds supported scripts until the relevant consent category is allowed, records visitor choices where consent records are enabled, and helps you keep your cookie declaration current — without an Umbraco package or changes to how your templates are built.
Consent before tracking
Supported analytics and marketing scripts are held until the relevant consent category is allowed, so their cookies are only set once the visitor consents.
Template-level implementation
CookieHub is added once, as custom code, in the master template your pages share. There is no Umbraco package to install.
A banner that fits your site
Match the consent banner’s layout, colors, positioning and buttons to your site from the CookieHub dashboard, without editing your Umbraco views.
Added once in your master template. No Umbraco package required.
CookieHub doesn’t use an Umbraco package. You paste the CookieHub implementation code right after the opening <head> tag of the template your pages share — commonly a master or layout template in the /Views folder — so it loads across your site. Once it is in place, CookieHub:
- holds supported non-essential tracking until the relevant consent category is allowed
- shows your cookie consent banner to visitors
- manages visitor consent preferences
- records consent decisions in a consent log, where consent records are enabled on your plan
- scans your site for cookies set by templates, embeds and external scripts
If some pages render from a different root template, add the code there too, so CookieHub loads on every page. Make sure the domain in your CookieHub dashboard matches the domain your Umbraco site runs on.
Umbraco installation guideCookie consent tools for your Umbraco site.
Automatic cookie blocking
Commonly used analytics and marketing services are held until the relevant consent category is allowed — including scripts your Umbraco templates load as the page renders.
Cookie scanner
Automated scans detect the cookies your site sets, including new ones introduced by template changes, embedded content and external scripts.
Customizable consent banner
Adjust the banner’s layout, colors, text, button styles and positioning so the consent experience matches your site’s design.
Consent logging
Keep a record of visitor consent choices in CookieHub’s consent log, where consent records are enabled on your plan.
Multilingual banners
Show the banner in your visitors’ language, with text that can switch based on browser language — useful for multilingual Umbraco sites.
Dynamic cookie declaration
A cookie declaration ready to embed on any Umbraco page. Cookie scan results help you review it and keep it in line with the cookies your site uses.
Add CookieHub to Umbraco in a few steps.
Everything happens in your Umbraco template: no package to install and no changes to how your templates are structured.
- 01
Get your implementation code
In the CookieHub dashboard, add your domain, choose a banner template and copy the CookieHub implementation code.
- 02
Open your templates
Log in to the Umbraco backoffice and open Settings › Templates, or open your project’s template files in your code editor.
Settings › Templates - 03
Find the main template
Open the master or layout template your pages share. Umbraco template files are commonly stored in the /Views folder.
/Views - 04
Locate the <head> tag
Find the opening <head> tag near the top of the template.
<head> - 05
Paste the code
Paste the CookieHub implementation code right after the opening <head> tag, as provided and above any other scripts. Don’t add async or defer.
- 06
Save the template
Click Save in the backoffice, or save the file and deploy it the way you normally release template changes.
Save - 07
Check the load order
Open your site and view the page source: the CookieHub code should come before any tracking scripts, so it loads first.
Consent control wherever Umbraco loads a script.
CookieHub’s automatic cookie blocker can handle commonly used services, as long as CookieHub loads before them. Services it doesn’t recognize may need manual consent tagging: for a script, set type="text/plain" and add the appropriate data-consent category; for an iframe, add the data-consent category and move its URL from src to data-src where required. Tagged content only loads once the visitor allows that category.
How to tag scripts for consentMaster templates and layouts
Scripts in the shared template’s <head> or before the closing </body> tag, which load on every page that uses it.
Page templates and partial views
Scripts in an individual template or partial view, which load only on the pages that use it.
Macros and block content
Scripts rendered by macros or by the views behind block-based content, such as a widget an editor adds to a page.
Embedded content
Videos, maps and other third-party iframes added to your content. The cookie scanner reports the cookies they set; services the blocker doesn’t recognize may need manual consent tagging.
Already using Google Tag Manager?
If your Umbraco site manages tags through Google Tag Manager, install CookieHub through GTM rather than adding a second implementation in your template.
View Google Tag Manager setupAdd a cookie declaration page
CookieHub generates a dynamic cookie declaration you can embed on any Umbraco page, so visitors can see which cookies your site uses.
Learn about the cookie declaration
Umbraco questions, answered.
No. CookieHub is a custom code integration added to your site’s frontend template, so no Umbraco package is required.
Open the template file your pages use — template files are commonly stored in the /Views folder — locate the opening <head> tag and paste the CookieHub implementation code right after it. Save the template, then check that CookieHub loads before any tracking scripts.
Yes. Add the code to the master or layout template your pages share, and CookieHub loads on every page that uses it. If your site uses more than one root or layout template, add the implementation code to each relevant template. Your templates don’t need to be restructured.
CookieHub runs in the visitor’s browser, so it handles scripts the same way whether they come from a template, partial view, macro or embed. Its automatic cookie blocker can hold commonly used services until the relevant consent category is allowed, provided CookieHub loads before them. Services it doesn’t recognize may need manual consent tagging on the script or iframe, so they only load once the visitor allows that category.
No. The automatic cookie blocker covers commonly used analytics and marketing services. Other scripts and embeds may need manual consent tagging: set a script’s type to "text/plain" and add the appropriate data-consent category, or add a data-consent category to an iframe and move its URL from src to data-src where required. A cookie scan shows which cookies your site sets, so you can see what still needs configuring.
No. CookieHub needs to load before the tracking scripts it controls. Paste the implementation code as provided, right after the opening <head> tag and above any other scripts.
Yes. You can adjust colors, layouts, button styles and text in the CookieHub dashboard to match your brand, without editing your Umbraco views.
Yes. CookieHub supports banners in multiple languages and can switch the banner text based on the visitor’s browser language.
Yes. CookieHub generates a dynamic cookie declaration that you can embed on any Umbraco page or content item. Cookie scan results help you review and maintain it as the cookies your site uses change.
Install CookieHub through Google Tag Manager instead of also adding it to your template. Use one implementation, not both.
CookieHub is a front-end consent layer: it runs in visitors’ browsers on your public site and doesn’t change how Umbraco renders pages on the server. The code sits in your site’s templates, not in the backoffice, and it only controls non-essential cookies — essential cookies the site needs to work are not blocked.
CookieHub provides tools that help Umbraco site owners meet consent requirements under privacy laws such as GDPR, CCPA and LGPD: holding supported non-essential tracking until consent, recording consent decisions where consent records are enabled, and helping you keep a cookie declaration up to date.
Add cookie consent management to your Umbraco site.
CookieHub gives Umbraco developers and content owners a straightforward way to manage cookie consent through their existing site templates.