Our.Umbraco.CookieConsent 17.1.0

dotnet add package Our.Umbraco.CookieConsent --version 17.1.0
                    
NuGet\Install-Package Our.Umbraco.CookieConsent -Version 17.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Our.Umbraco.CookieConsent" Version="17.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Our.Umbraco.CookieConsent" Version="17.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Our.Umbraco.CookieConsent" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Our.Umbraco.CookieConsent --version 17.1.0
                    
#r "nuget: Our.Umbraco.CookieConsent, 17.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Our.Umbraco.CookieConsent@17.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Our.Umbraco.CookieConsent&version=17.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Our.Umbraco.CookieConsent&version=17.1.0
                    
Install as a Cake Tool

Our.Umbraco.CookieConsent

Umbraco Marketplace NuGet Downloads GitHub License

Easily add a configurable cookie consent banner to your Umbraco site. Features include a dashboard for customizing behavior, appearance, and translations, using the Orestbida/CookieConsent library.

Requirements

Umbraco 17 on .NET 10

Umbraco 13 on .NET 8 is supported by the 13.x.x releases, built from the master branch.

Installation

dotnet add package Our.Umbraco.CookieConsent

Then render the banner by adding this line to your main layout file (_Layout.cshtml or equivalent):

@await Component.InvokeAsync("Cookie")

The settings table is created on the first startup, and the dashboard shows the default settings until you save for the first time

Configuration

  1. Access the dashboard
    Navigate to the Settings section in the Umbraco Backoffice, and then select the Cookie Consent dashboard to manage all settings related to your banner.

  2. Customize appearance and behavior
    Use the dashboard to configure:

    • Position of the banner on your site.
    • Categories of cookies to display.
    • Layout and styles to match your site’s design.
    • ...
  3. Manage translations

    • Translations for the popup text can be managed in the Translations section of Umbraco, under the key Our.Umbraco.CookieConsent.
    • The available languages for the cookie consent popup depend on the languages configured for your Umbraco site.
    • Keys for a category are created the first time you save the settings with that category enabled.

Custom scripts

You can define custom scripts that are injected only after user consent, based on the selected cookie category (e.g. Analytics, Marketing, etc.).

To do so:

  • Navigate to the "Custom scripts" section in the dashboard
  • Add a new entry with the target category (Analytics, Marketing, etc.)
  • Paste your script using safe JS, such as dynamic script injection

Important: HTML <script> tags cannot be directly used inside JavaScript blocks. Instead, use JavaScript to create and inject scripts dynamically.

Example: Google Analytics script

    var gtagScript = document.createElement('script');
    gtagScript.src = 'https://www.googletagmanager.com/gtag/js?id=G-CN4GDXXXXX';
    gtagScript.async = true;
    document.head.appendChild(gtagScript);

    gtagScript.onload = function () {
        window.dataLayer = window.dataLayer || [];
        function gtag(){ dataLayer.push(arguments); }
        window.gtag = gtag;

        gtag('js', new Date());
        gtag('config', 'G-XXXX');
    };

This logic will only be executed if the user accepts the analytics category

Built-in scripts

The "Built-in Scripts" section covers integrations that need to run before consent is given, which custom scripts cannot do

Add an entry, pick a provider and fill in its ID. Each one loads before consent is given and is held until the visitor makes a choice.

The two Google providers implement Google Consent Mode: the package sets every consent signal (ad_storage, ad_user_data, ad_personalization, analytics_storage, ...) to denied before any Google script runs, then updates them as soon as the visitor makes a choice, so Google receives consent signals rather than nothing at all. Pick the one that matches how Google is loaded on your site:

  • Google Analytics loads gtag.js directly. Fill in your measurement ID (G-XXXXXXXXXX). Use this when you do not go through Tag Manager, and in that case do not also load GA4 from a container or it runs twice.
  • Google Tag Manager loads the gtm.js container. Fill in your container ID (GTM-XXXXXXX). The package only sends the consent signals; for them to gate anything, turn on the Consent settings of your tags inside Tag Manager.
  • Facebook Pixel loads the Meta Pixel with consent revoked (fbq('consent', 'revoke')), then grants it once the visitor accepts the Marketing category and revokes it again on withdrawal. Fill in your pixel ID (a numeric value). Keep the Marketing category enabled, or the Pixel stays revoked.

Leave the ID empty and nothing is injected.

Credits

This package is a simple integration of the CookieConsent library, created by Orest Bida.

Cookie icons used in this project were created by Rohim - Flaticon.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
17.1.0 94 8/13/2026
17.0.0 114 7/28/2026
13.1.0 81 8/12/2026
13.0.0 111 7/27/2026
0.0.4 114 7/22/2026
0.0.3 393 7/7/2025 0.0.3 is deprecated because it has critical bugs.
0.0.2 506 4/21/2025
0.0.1 835 12/6/2024