integrate cookiebot consent management into matomo

4/9/2021 3-minute read

creating a new measurable in matomo had already created a tag manager container for us - which we need to modify before we can use it -

please double check for correct scope (here “KABEQ”) and correct container (default)

prepare code snippet

we need to prepare a little piece of javascript which we will need soon in the course of this configuration

<!-- Cookiebot -->
<script>
    function CookiebotCallback_OnAccept(){
        var c = Cookiebot.consent;
        function m(a){_mtm.push({event:"cookie_consent_"+a})};
        c.preferences && m("preferences"),
        c.statistics && m("statistics"),
        c.marketing && m("marketing");
    }
    (function(C,oo,k,ie,b,o,t){  b=C.createElement(oo),o=C.getElementsByTagName(oo)[0];
 b.src='https://consent.cookiebot.com/uc.js?cbid='+ie;   b.id=k;b.async=!0;o.parentNode.insertBefore(b,o);
    })(document,'script','Cookiebot','00000000-0000-0000-00000-000000000000')
</script>
<!-- End Cookiebot-->

This codelet was found on a cookiebot support page (see “credits” section below)

tailoring to your cookiebot number

Please replace this string ‘00000000-0000-0000-00000-000000000000’ in the script above by the Domain Group ID from cookiebot which can be found at https://manage.cookiebot.com - Settings - Your Scripts:

and copy/paste it from there.

start from dashboard (for the default container)

In the default container which has been created automatically when we created the measurable we should see 1x tag and 1x variable

please click now on “create trigger” for the next step

create trigger

triggers can be of various types -

please select “Custom Event” for the next step

create trigger of type custom event

please provide “Cookie Consent Statistics” as Name - and “cookie_consent_statistics” as Event Name -

double check correct spelling - then click “create new trigger”

confirmation new trigger created

you should get a confirmation message like the one shown here

Do not “publish” yet - as suggested in the success message -

instead you may want to repeat this step twoo times more for

  • “Cookie Consent Preferences” as Name - and “cookie_consent_preferences” as Event Name -

and

  • “Cookie Consent Marketing” as Name - and “cookie_consent_marketing” as Event Name -

review triggers

in addition to the trigger “pageview” (which was created automatically when the container was created) you should now also find the triggers that you just created of type custom event

when everything looks like on this screenshot - move on to “Variables” in the left hand menu

begin to create variables

double check scope (1)

click on “Variables” menu (2) and “create new variable” (3)

create variable of type

hh

hh

hh

hh

hh

hh

hh

hh

hh

hh

hh

hh

hh

hh

hh

hh

hh

hh

credits

These instructions is this story had been copied and slightly modified from this source: https://support.cookiebot.com/hc/en-us/articles/360017539960-Matomo-deployment - by Richard van der Velde