Matomo, a popular open-source analytics platform, does use cookies for analytics and tracking.
Matomo's cookies are primarily used for tracking website interactions and gathering data on user behavior.
Matomo's cookies can be categorized into different types, including first-party cookies, which are set by the website itself, and third-party cookies, which are set by external services.
Matomo's first-party cookies are used to store user preferences and settings, such as language and timezone.
Does Matomo Use Cookies?
Matomo uses cookies to store information about visitors between visits for accurate reporting of new and returning visitors.
For instance, Matomo uses cookies to remember if someone gave consent to tracking or opted out of tracking. This is essential for maintaining data ownership and GDPR compliance.
Matomo also uses cookies to remember if a user has given consent to tracking by setting a cookie named "consent". This cookie will exist as long as the user has given consent.
You can let Matomo remember the consent by calling the following method once the user has given their consent: _paq.push(['rememberConsentGiven']) or _paq.push(['rememberCookieConsentGiven']).
By default, the cookie and consent will be remembered forever, but you can define an optional expiry period for your user consent by calling: _paq.push(['rememberConsentGiven', optionallyExpireConsentInHours]) or _paq.push(['rememberCookieConsentGiven', optionallyExpireConsentInHours]).
Here are some key points to keep in mind when implementing consent in Matomo:
- By default, the cookie and consent will be remembered forever.
- You can define an optional expiry period for your user consent.
- You need to ensure that the user does not disable first-party cookies for the consent to work.
- When tracking multiple sub-domains into the same website in Matomo, you may need to restrict or widen the scope of the consent cookie domain and path.
Configuring Matomo
Configuring Matomo involves setting up cookies to remember user consent. Matomo uses cookies to store information about visitors between visits, including consent to tracking.
To let Matomo remember user consent, you can call the following method once the user has given their consent: _paq.push(['rememberConsentGiven']) or _paq.push(['rememberCookieConsentGiven']). This will set a cookie named "consent" that will be remembered forever, unless you specify an optional expiry period.
You can also use the CookieHub tag to enable automatic consents, which will listen to the analytics consent in CookieHub and execute the command to set cookies for analytics. This can simplify your Matomo implementation.
Here's a summary of the steps to configure Matomo for cookie consent:
- Call _paq.push(['rememberConsentGiven']) or _paq.push(['rememberCookieConsentGiven']) to set a cookie named "consent" that will be remembered forever.
- Optionally specify an expiry period for user consent by calling _paq.push(['rememberConsentGiven', optionallyExpireConsentInHours]) or _paq.push(['rememberCookieConsentGiven', optionallyExpireConsentInHours]).
- Use the CookieHub tag to enable automatic consents and simplify your Matomo implementation.
Pk Cvar
Pk Cvar is a session-based cookie that stores custom variables in key-value pairs. This allows you to define additional metadata about the visitor or their actions during a session.
You can use it to track any custom data you want, such as visitor preferences or purchase history. It's only applicable to the current visit, so data is cleared when the session ends.
To make the most of Pk Cvar, consider what additional information you want to collect about your visitors. This could be anything from language preferences to geographic location.
Matomo Tracking Options
Matomo Tracking Options are quite flexible. Matomo allows you to set cookies only when using specific features like Heatmaps, A/B testing, or consent management.
There are different types of cookies set by Matomo, including strictly necessary or essential cookies, cookies for first-party website analytics, and optional third-party cookies. The strictly necessary cookies include matomo_sessid, mtm_consent_removed, and mtm_cookie_consent, which are used for security, opt-out management, and consent management respectively.
You can control the expiry period of cookies, for example, the cookie "consent" is remembered forever by default, but you can define an optional expiry period by calling _paq.push(['rememberConsentGiven', optionallyExpireConsentInHours]).
Here is a list of the main cookies and their purposes:
Tracking vs Legitimate Interest
When tracking user behavior, you must decide whether to rely on tracking or legitimate interest as your basis for data collection.
Tracking requires explicit consent from users, which can be a significant barrier to collecting data. This includes cookie consent notices and opt-in forms.
Legitimate interest, on the other hand, allows for data collection without explicit consent, but you must demonstrate a clear and legitimate reason for doing so.
In Matomo, you can use the "Tracking" option to enable tracking on your website, which requires explicit consent from users.
The "Legitimate Interest" option, as seen in the "Data Protection and Cookies" section, allows for data collection without explicit consent, but you must demonstrate a clear and legitimate reason for doing so.
In the "Data Protection and Cookies" section, it's mentioned that you can use the "Legitimate Interest" option to collect data for purposes such as improving website performance.
Optional
Optional cookies are used in specific Matomo features, such as Heatmaps, A/B testing, or consent management.
These cookies are not set by default and only occur when a particular feature is being used.
Here's a breakdown of the optional cookies used in Matomo:
To use these optional cookies, you need to enable the specific feature in Matomo, such as Heatmaps or A/B testing.
Managing Cookies with Matomo
Managing cookies with Matomo is a crucial aspect of ensuring user privacy and compliance with regulations like GDPR. Matomo uses cookies to store information about visitors between visits and to remember if someone gave consent to tracking or opted out.
You can disable tracking cookies in Matomo by adding a line of code to the JavaScript, which will make data slightly less accurate. This can also allow you to track visitors without displaying a cookie consent screen, and you can keep tracking even if users reject cookie consent.
Matomo stores a cookie named "mtm_consent" to store the visitor's consent status for tracking purposes. This cookie's expiry may be subject to the same deletion as the "mtm_consent_removed" cookie. You can define a shorter expiry period for user consent by calling _paq.push(['rememberConsentGiven', optionallyExpireConsentInHours]).
To let Matomo remember the consent given by a user, you can call the following method once the user has given their consent: _paq.push(['rememberConsentGiven']). This will set a cookie named "consent" and Matomo will know that consent has been given, automatically processing the data.
Here are some key considerations for managing cookies with Matomo:
- By default, the cookie and consent will be remembered forever. You can define an optional expiry period by calling _paq.push(['rememberConsentGiven', optionallyExpireConsentInHours]) or _paq.push(['rememberCookieConsentGiven', optionallyExpireConsentInHours]).
- When tracking multiple sub-domains into the same website in Matomo, you want to ensure that when you ask for Consent, the user gives consent for all the sub-domains on which you are collecting data.
- For the consent to work, it is required that user does not disable first party cookies.
If you want to track visitor metrics without using cookies, you can add the following code to the header of each website page: _paq.push(['requireConsent']). This will ensure that Matomo will not perform any tracking if consent is not given in CookieYes.
Frequently Asked Questions
How do I force tracking without cookies in Matomo?
To force tracking without cookies in Matomo, log in as a super user and enable the "Force tracking without cookies" checkbox in Administration > Privacy > Anonymize data. This will update the JavaScript tracker to automatically track without cookies.
Sources
- https://matomo.org/blog/2020/02/web-analytics-cookies-gdpr/
- https://matomo.org/faq/general/faq_146/
- https://developer.matomo.org/guides/tracking-consent
- https://digitalist.cloud/blog/cloud-4/matomo-cmp-with-digitalist-cloud-and-cookiehub-18
- https://matomo.org/faq/how-to/using-cookieyes-consent-manager-with-matomo/
Featured Images: pexels.com