Matomo deployment

Follow

Comments

2 comments

  • Avatar
    Jan

    Thank you for this article. I've got two thoughts on it:

    • Will this work with Cookiebots automaticcookie blocking?
    • How can I use the cookieless tracking when the user rejects cookies like when I use _paq.push(['requireCookieConsent']); 


    0
    Comment actions Permalink
  • Avatar
    Richard van der Velde

    Hi Jan,

    You can use auto blocking, but you will have to make small changes. The script in step 1 needs to be reduced to:

    <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");
        }
    </script>

    This ensures that the actual Cookiebot script isn't added by Matomo, but it does add the code needed for Cookiebot to send consent information to it.
    Next, you'll want to ensure that the Cookiebot script with auto blocking is added inline after the Matomo script (which should load as soon as possible, preferably before anything else):

    <script id="Cookiebot" type="text/javascript" src="https://consent.cookiebot.com/uc.js" data-cbid="00000000-0000-0000-0000-000000000000" data-blockingmode="auto"></script>

     

    If you want to use cookieless tracking, you can do so by slightly modifying the command:

    !Cookiebot.consent.marketing && _paq.push(['requireCookieConsent']);
    0
    Comment actions Permalink

Please sign in to leave a comment.