Sometimes, there are non human (bots) that visit your website. These bots can have many purposes (such as security scanning, performance scanning, monitoring, search engine bot, spam bot, etc.). Often, you do not want these bots to be tracked in Matomo (Piwik), because you may want to focus on how humans use the website, and not bots. In this case, you can tell Matomo to exclude traffic where the User-Agent of these requests match a given string.

Some bots are not tracked by default

Some of the visits with a specific user-agent will be detected by Matomo as a bot, and won’t be tracked. You can test if a User-Agent is detected as a bot by going to your Matomo > Administration > Diagnostic > Device Detection. In the “User-Agent” text field, copy paste the user agent you want to check. You can also check online on devicedetector.net.

How do I exclude new bots from being tracked?

To exclude traffic for a particular User agent (or several user agents), go to “Administration”, click on “Settings” under the “Websites” (or “Measurables”) section. Below the list of websites, you will find the option to specify “Global list of user agents to exclude”. You can enter there a list of user agents to exclude from being tracked by Matomo. Put one user agent per line. If the visitor’s user agent string contains any of the strings you specify, the visitor will be excluded from Matomo. You may also toggle the checkbox “Enable website specific user agent exclusion.” to enable this feature as a new column for each website in the Websites listing.

As of Matomo 4.1.1 it is also possible to exclude useragents using a regex (e.g. /bot|spider|crawl|scanner/i).

Notes:

  • when you exclude some traffic, it will only exclude it going forward and is not applied retroactively.
  • make sure not to include a very short string (with few characters) as it could block more requests than you would expect.

See also: Exclude traffic from IP address or IP ranges

Previous FAQ: How do I set some of my website directories or pages to not be tracked?