How do I set some of my website directories or pages to not be tracked?
If you wish to set some specific pages or directories to not be tracked by Matomo (Piwik), we recommend that you modify the Matomo Javascript Tracking code, and replace
_paq.push(['trackPageView']);
by a small if statement to test whether the current page must be tracked or not.
To exclude traffic for all page URLs which contain /admin
or which contain user/private
, write:
if (!window.location.pathname.match(/(\/admin|user\/private)/))
{
_paq.push(['trackPageView']);
}
In this example, all URLs except the ones containing « /admin » or « user/private » will be tracked by Matomo.
If you are not using the JavaScript tracker but you are using the Server Log Analytics capability, then you can exclude particular log lines from being imported by adding the parameter --exclude-path=
such as python misc/log-analytics/import_logs.py --exclude-path=*/exclude/* --exclude-path=*/also-exclude/* [...]