In this FAQ you will learn how to exclude specific tracking requests from being recorded across all sites depending on the sent Tracking API Parameters. This feature can be useful for example in these cases:

  • you need to urgently stop specific requests from being tracked to temporarily fix a performance issue. For example, you start tracking a new event in a website or application and suddenly get sent a massive amount of tracking requests due to a bug in the tracking code implementation. Using this feature you can exclude the specific tracking requests for this newly added event but keep tracking all the other regular tracking requests.
  • you want to ensure certain requests will never be recorded for example for privacy or security reasons and you can’t remove the tracking code from these pages.

Requirements

To use this feature you need to have Matomo On-Premise 4.0 or newer and you need to be able to modify the Matomo config file in $matomoRoot/config/config.ini.php.

You can also configure this setting on a per site basis.

Configuration

Add the following line to your config file to configure this feature:

[Tracker] # only add this line if it doesn't exist yet
exclude_requests = ""
  • The structure for this configuration is: {tracking parameter name}{operand}{value to match}
  • The following operands are supported:
    • Equals: ==
    • Not equals: !=
    • Contains: =@
    • Not Contains: !@
    • Starts with: =^
    • Ends with: =$
  • The value to match on the right side should be URL encoded. For example: "action_name==foo%2Cbar" would exclude page titles with the name « foo,bar ».
  • All comparisons are performed case insensitive.

For example "e_c==Media" means that all tracking requests will be excluded where the event category is Media.

Multiple exclusions can be configured separated by a comma. The request will be excluded if any expressions matches (not all of them). For example: "e_c==Media,action_name=@privacy". This would additionally exclude any request from being tracked where the page title contains privacy.

For a list of tracking parameters you can use on the left side view the Tracking API Reference.

More examples:

  • Exclude all tracking requests for a specific site with ID 1: "idsite==1"
  • Exclude where the event name is « file »: "e_n==file"
  • Exclude where the page URL contains « restricted »: "url=@restricted"
  • Exclude when cookies were used (for example you want to make sure to not track requests where cookies were used for privacy compliance): "_id!="
  • Exclude logged in users: "uid!="
  • Exclude not logged in users: "uid=="
  • Exclude where the downloaded file URL contains « token »: "download=@token"

Other ways Matomo allows you to exclude traffic (directly in the Matomo UI):