Analytics and Matomo

CrossmarX offers Matomo as an alternative for Google Analytics. It is hosted by CrossmarX inder the same conditions as your own applicacation, on a EU server.

If you use Matomo (or a different analytics method) you need to mention this in your Privacy statement. Also you may need to use a cookie bar to get permission to track the user. This depends on how much data you are tracking. There are 2 options:

1) Cookie-less tracking. This collects less accurate data. For instance, you can see where people are visiting your application from but not how many unique vists you have had because individual data is not tracked.

2) Tracking with cookies. This will collect more detailed data. But you need to ask the user permission with a cookie banner.
How this is done in the Matomo tracking script is described in their faq https://matomo.org/faq/general/faq_157/ under Disable cookies for a specific site when you are using Matomo On-Premise or Matomo Cloud.

 

Crossmarx offers example scripts of how to set both options.

1) If you have installed Matomo on your website with the JavaScript tracking code, it is easy to disable tracking cookies by adding one line in the Matomo Javascript code. Simply find the tracking code in your sites editor and look for the line that includes _paq.push(['trackPageView']); and add the function _paq.push(['disableCookies']); on the line before that. So afterwards that section of your code will look a little something like this:

[...]
// Call disableCookies before calling trackPageView 
_paq.push(['disableCookies']);
_paq.push(['trackPageView']);
[...]

2) Below is an example with a cookie bar. The cookie bar presents you with the options to accept or decline the cookies. If it is accepted the analytics script is loaded. There is also a link to your privacy policy. Change $siteId to the Matomo site id corresponding with your application. Change $pathToPrivacyPolicy to your privacy policy page.

#set($cookiesApproved = $session.getCookie('appCookiesApproved'))
#if($cookiesApproved == true)
    #set($siteId = 1)
    <script>
        var _paq = window._paq = window._paq || [];
        _paq.push(['trackPageView']);
        _paq.push(['enableLinkTracking']);
        (function() {
            var u = "https://analytics.crossmarx.nl/";
            _paq.push(['setTrackerUrl', u+'matomo.php']);
            _paq.push(['setSiteId', '$siteId']);
            var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
            g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
        })();
    </script>
    <noscript><p><img referrerpolicy="no-referrer-when-downgrade" src="https://analytics.crossmarx.nl/matomo.php?idsite=$siteId&amp;rec=1" style="border:0;" alt="" /></p></noscript>
#elseif(!$cookiesApproved)
    #set($pathToPrivacyPolicy = "/path-to-privacy-statement")
    <div id="app_cookie-bar" class="fixed-bottom pt-3 pb-3 bg-dark">
        <div class="container-xl">
            <span class="text-white">This website uses cookies.</span>
            <a href="pathToPrivacyPolicy" class="mr-3">Read more in the privacy statement</a>
            <div class="float-righdt mt-3 mt-md-0 d-md-inline">
                <a class="btn btn-primary" href="#" onclick="document.cookie='appCookiesApproved=true; path=/; Max-Age = 31536000';document.getElementById('app_cookie-bar').style.display = 'none';return false;">Accept</a>
                <a class="btn btn-secondary" href="#" onclick="document.cookie='appCookiesApproved=false; path=/; Max-Age = 31536000';document.getElementById('app_cookie-bar').style.display = 'none';return false;">Decline</a>
            </div>
        </div>
    </div>
#end