Plugin documentation

DeleteVisitsFilter

Pick websites, a date range and a Matomo segment, check the matches, then delete them, even millions of visits at once.

Plugin page Download ZIP

Overview

Remove bot traffic, referrer spam and test data from Matomo: choose websites, a date range and a segment, check the matches, then delete them for good.


The problem

Bots that look like real visitors, referrer spam or test traffic that slipped through: once such visits are in Matomo, they distort visits, bounce rate and conversion rates in every report. Matomo's GDPR tool can delete data, but it is made for individual people, not for thousands of visits across several websites and months.

The solution

DeleteVisitsFilter deletes every visit that matches a Matomo segment, on one website, several or all of them, in any date range. You see what will be deleted before anything happens, and large deletions keep running in the background until they are done.


Features

Choose exactly what goes

  • Websites: one website, several (also all whose name contains a text) or all websites
  • Date range: presets such as Last 30 days or Last year, or any range from the calendar, counted in each website's time zone
  • Segment: a saved segment, Matomo's segment editor or plain text with a syntax hint and a character counter
  • Any Matomo segment works, for example IP ranges, referrers, browsers or page URLs

Check before you delete

  • Check matches shows the matching visits per website and in total
  • A sample of matching visits with time, IP, browser, entry page and referrer, each with a link to the visitor profile
  • A link to the visitor log for every website, filtered by segment and date range
  • A confirmation that lists websites, date range and segment; from 10,000 visits on you type the number of visits

Built for large clean-ups

  • Deletions run as jobs in small steps, so even millions of visits do not run into timeouts
  • The progress shows the deleted visits, the current website, the speed and the estimated remaining time
  • Reload or close the page: the deletion continues in the background
  • Cancel at any time; visits deleted so far stay deleted
  • Very large deletions run on the console without a time limit

Clean data, correct reports

  • Visits are removed with all their data from Matomo's raw data tables, including those of other plugins, with the same routine as Matomo's GDPR tool
  • The affected days are marked for re-processing, including roll-ups, so the next archiving run rebuilds the reports

History

  • Every deletion with date, person, websites, segment, status, deleted visits and duration
  • Filters by status and by where a deletion was started: admin page, console or API
  • Details with the deleted rows per table
  • Use as template fills the form with an earlier deletion, Try again continues a failed one

Console and API

./console feinwerkdeletevisitsfilter:delete 1,3 "visitIp>=192.0.2.0;visitIp<=192.0.2.255" 2026-01-01 2026-09-30 --dry-run
./console feinwerkdeletevisitsfilter:work
  • Count, delete, list and cancel deletions from the command line or through the HTTP API

Fits into Matomo

  • Works in Matomo's light and dark mode
  • English and German

Technical details

Requirements

  • Matomo 5.1 or newer (5.x)
  • PHP 8.1 or newer
  • Super user access

Upgrading from DeleteVisitsFilter

Up to version 1.x this plugin was called DeleteVisitsFilter. Activate FeinwerkDeleteVisitsFilter, then uninstall DeleteVisitsFilter. Nothing needs to be migrated, and the old console command deletevisitsfilter:delete keeps working.

Use cases

  • See before you delete: Check matches shows the visits per website, a sample with visitor profiles and a link to the visitor log. Nothing is deleted until you confirm.
  • Built for large clean-ups: Deletions run as jobs in small steps. Close the page and they continue in the background; very large ones run on the console without a time limit.
  • Reports stay correct: Visits are removed with all their data, with the same routine as Matomo's GDPR tool, and the affected days are processed again automatically.

Step-by-step setup

Installation and activation are covered in Installing plugins. Only super users can delete visits. Deleted visits cannot be restored, so make a database backup first.

  1. Open the page. Go to Administration → Diagnostics → Delete Visits. The page has two tabs: Delete and History.
  2. Choose the websites. One website, Several websites or All websites. With several websites, add them one by one with Add website, or add all whose name contains a text: type it into Name contains … and click Add all matching.
  3. Choose the date range. Presets such as Yesterday, Last 30 days, Last month, This year or Entire period, or any range from the calendar under Custom. Whole days count, in each website's time zone.
  4. Set the segment. Pick a Saved segment, build one in the Segment editor, or switch to As text and type the definition. In text, a comma means OR and a semicolon means AND, for example visitIp==192.0.2.10,visitIp==192.0.2.11;browserCode!=FF. A segment can be up to 8,192 characters long. Conditions without a value are refused, so an empty row in the editor never matches every visit by accident.
  5. Check the matches. Check matches shows the matching visits per website and in total, plus a sample with time, IP, browser, entry page and referrer. Visitor profile opens a visit in detail, View in visitor log shows all matches of a website in the visitor log. Nothing is deleted yet. If you change a setting, the result disappears and you check again.
  6. Delete. Delete … visits opens a confirmation that lists websites, date range and segment. From 10,000 visits on you type the number of visits to confirm, then click Delete now.
  7. Follow the progress. Running deletion shows how many visits are deleted so far and which website is being worked on. You can reload or close the page, the deletion continues in the background. Cancel stops it; visits deleted so far stay deleted.
  8. Look at the history. The History tab lists every deletion with status, deleted visits and duration, filtered by status and by where it was started. Details shows the deleted rows per table, Use as template fills the form with an earlier deletion and Try again continues a failed one.

Settings

Under Administration → System → General settings → FeinwerkDeleteVisitsFilter:

  • Background processing time per hour (seconds) (default 300, allowed 0 or 60 to 3300): how long the hourly background task keeps working on open deletions. 0 turns it off; then keep the page open or use the console.
  • Default batch size (default 1000, allowed 100 to 10000): visits per step. For a single deletion you change it under Advanced.

The background task runs with Matomo's scheduled tasks, i.e. by cron with core:archive or through browser-triggered archiving.

Console

In the Matomo directory, with super user rights:

# Count only, delete nothing
./console feinwerkdeletevisitsfilter:delete 1,3 "visitIp>=192.0.2.0;visitIp<=192.0.2.255" 2026-01-01 2026-09-30 --dry-run

# Delete (asks first, --yes skips the question)
./console feinwerkdeletevisitsfilter:delete all "referrerUrl=@seo-offers.example.net" 2026-01-01 2026-09-30

# Work on open deletions without a time limit, e.g. from cron
./console feinwerkdeletevisitsfilter:work
./console feinwerkdeletevisitsfilter:work --max-time=3000

# List deletions or cancel one
./console feinwerkdeletevisitsfilter:jobs
./console feinwerkdeletevisitsfilter:jobs --cancel=12

Give the websites as one ID, a list such as 1,3, or all. Without a terminal, i.e. in cron jobs and scripts, delete needs --yes.

Practical examples

A bot network in a data center. Hundreds of visits a day from the same IP range, each with a single pageview. With visitIp>=192.0.2.0;visitIp<=192.0.2.255, Several websites and Last 30 days you first see the matches per website, open a few visitor profiles and then delete them all in one go.

Referrer spam. Unknown domains show up as referrers although no link ever existed. referrerUrl=@seo-offers.example.net,referrerUrl=@cheap-traffic.example.org;actions==1 matches all visits from these domains that opened only one page.

Your own visits before you excluded them. Before your office network was excluded in Matomo, staff visits were counted. Save the IP range as a segment, choose All websites and the period up to the exclusion.

Test data from a staging system. A test system tracked with the live website ID. pageUrl=@staging.example.com finds these visits. As the segment is based on pageviews, the whole visit is deleted each time.

Together with TrackingSpamScore. TrackingSpamScore detects spam networks and blocks them from now on. Visits that were already tracked are deleted here with its segments, such as spamAsn==64500 or spamScore>=90.

Good to know

  • Permanent: Deleted visits are gone. That is why the page always shows the matches first and asks for confirmation.
  • Whole visits: The whole visit is deleted with all its pageviews, events and conversions, even if the segment only concerns one page, such as pageUrl=@/spam.
  • All raw data: The plugin removes the visits from all of Matomo's raw data tables, including those of other plugins, with the same routine as the GDPR tool. Matomo's shared table of page and action names is not touched; Matomo removes unused entries itself.
  • Reports: The days that contained deleted visits are marked for re-processing, including roll-up websites. The next archiving run rebuilds their reports without the deleted visits.
  • One deletion at a time: Deletions run one after another. A new deletion shows Waiting until the previous one has finished. If the console or the background task is already working, the page tells you so.
  • Stopping on the console: Ctrl+C only ends the output; the deletion continues in the background. Cancel it with feinwerkdeletevisitsfilter:jobs --cancel=<ID> or on the page.
  • Audit trail: The history shows who started which deletion. If the Activity Log plugin is installed, every deletion is recorded there as well.
  • Upgrading from DeleteVisitsFilter: Up to version 1.x the plugin was called DeleteVisitsFilter. Activate FeinwerkDeleteVisitsFilter, then uninstall DeleteVisitsFilter. Nothing needs to be migrated, and the old command deletevisitsfilter:delete keeps working.
  • Troubleshooting: If a deletion stays on Waiting, check that scheduled tasks run, or start feinwerkdeletevisitsfilter:work. Continue a Failed deletion with Try again in the history. More in Troubleshooting.

Technical reference

PropertyValue
Technical nameFeinwerkDeleteVisitsFilter
Current version2.2.1
Matomo≥ 5.1.0, < 6.0.0
PHP≥ 8.1.0
Licensefree
Database changesnone in the current version

FAQ

How is this different from Matomo's GDPR tool?

The GDPR tool is made for individual people: you look up a visitor and delete their data. DeleteVisitsFilter deletes every visit that matches a segment, across several websites and any date range, in one go, and keeps working in the background.

Can I undo a deletion?

No. Deleted visits are gone for good. That is why the plugin shows the matches first, asks for confirmation and, from 10,000 visits on, asks you to type the number. Make a database backup before large deletions.

What happens to my reports?

The days that contained deleted visits are marked for re-processing, including roll-ups. The next archiving run rebuilds their reports without the deleted visits.

Who can delete visits?

Only super users. The history shows who started each deletion, and if the Activity Log plugin is installed, every deletion is recorded there too.

Is it free?

Yes. DeleteVisitsFilter is free and licensed under the GPL.