CookieBot

Details an integration available for Cookiebot, built and maintained by Umbraco HQ.

This integration provides an implementation model for the Cookiebot banner and declaration.

Minimum version requirements

Umbraco CMS

MajorMinor/Patch

Version 10

10.0.0

Version 11

11.0.0

Configuration

The following configuration is required for the Cookiebot scripts to be loaded correctly:

appsettings.json
"Umbraco": {
  "Cookiebot": {
    "Settings": {
      // CBID = Cookiebot Identifier
      "Id": "[YOUR_CBID]"
    }
  }
}

Templating

The package is a reusable Razor class library that will allow editors to load the Cookiebot Banner and Declaration scripts.

The banner script needs to be inserted as the first script of the website, by placing it within the <head></head> tag using this syntax:

@await Html.PartialAsync("~/Views/Partials/UmbracoCms.Integrations/Analytics/Cookiebot/Banner.cshtml")

The Declaration script can be added to whatever page you want, using this syntax:

@await Html.PartialAsync("~/Views/Partials/UmbracoCms.Integrations/Analytics/Cookiebot/Declaration.cshtml")

Both scripts "pick up" CBID from the website's configuration file and update the details accordingly.

Custom Implementations

This integration demonstrates how an Umbraco package can be used as an integration with a script-based provider, using partial views and the IConfiguration interface.

You can use this package as a reference for creating integrations with other providers using scripts:

  1. Create a new Razor class library for your integration.

  2. Add partial views where you insert your custom script code.

  3. Inject the IConfiguration interface into your view: @inject Microsoft.Extensions.Configuration.IConfiguration Configuration.

  4. Use Configuration[YOUR_SETTINGS_PATH:KEY] to retrieve the required configuration values.

  5. Add umbraco-marketplace.json file with Marketplace details of the package.

Once your integration is ready, all that remains to do is to deploy the package to NuGet.

Last updated