How do I disable all cookies for a visitor?
Disable cookies for all sites within Matomo
Disable cookies for a specific site when you are using Matomo On-Premise or Matomo Cloud
See also: List of cookies used by Matomo.
_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']); [...]
That’s it! Matomo will no longer collect any personal data through tracking cookies. If you’d only like to disable cookies until someone has consented to their use, view the developer documentation on cookie consent.
If you are using Matomo for WordPress
Log in to your WordPress Admin Dashboard. Go to “Matomo Analytics -> Settings”. You will see the tracking settings page. To disable cookies enable the option “Disable cookies” and press “Save changes”.
- Log in to your WordPress Admin Dashboard.
- Go to the Matomo Analytics section and click to view the Settings page.
- Scroll down to the Disable cookies checkbox and make sure it is selected.
- Scroll to the bottom of the page and click Save changes to confirm.
If you are using Matomo Tag Manager
There are two main ways of disabling cookies via Tag Manager, depending on whether you are using a cookie consent solution or not.
Cookies fully disabled
You can use a built-in feature that enables you to disable cookies. When setting up your Matomo configuration variable, make sure the Disable Cookies checkbox is enabled.
- When creating a Matomo Tag, you will see a Matomo Configuration setting. If you haven’t already created one, then click the Create New Matomo Configuration link to load the builder.
- Once it has loaded, complete all of the required details and then scroll down to the checkbox that says Disable cookies.
- Click Create New Variable to confirm your configuration.
When using Matomo Tag Manager with a cookie consent solution
_paq.push(['requireCookieConsent']); in this tag. You would also need to create a Trigger on “DOM Ready” (which will be executed first before the Pageview trigger). Then in your Custom HTML tag, set “Execute this tag when any of these triggers are triggered.” to “DOM Ready”.
Implications on data accuracy
Learn more how cookie affect data accuracy in our FAQ: When cookies are disabled by a visitor, how does it impact Matomo (Piwik) reports accuracy?
Implication on cookie consent banner and asking user for consent
Essential non-analytics cookies that may still be created
It is important to note that even when cookies are disabled, Matomo may still set essential cookies in some cases, but these are purely functional and contain no personal data that would be covered by privacy laws. In fact, all of these cookies are actually designed to increase user security and privacy. The essential cookies and the reasons you might expect to find them are:
- piwik_ignore – When you exclude yourself from being tracked using the cookie method or using the iframe opt-out method, Matomo will create a cookie
piwik_ignoreset on the domain of your Matomo server
- MATOMO_SESSID –
MATOMO_SESSIDis a temporary short-lived cookie that provides a nonce – basically a random number – which helps to prevent CSRF security issues while users opt-out of tracking.
- mtm_consent and mtm_consent_removed – When you’re asking for consent before tracking visitors, these two cookies may be created:
- _pk_testcookie – The
_pk_testcookieis only used to check whether the visitor’s browser supports cookies and is created without any identifier and is directly deleted.