How to reduce your Matomo Cloud quota usage with pre-ingestion traffic filtering
By applying pre-ingestion traffic filtering, you can manage your Matomo Cloud quota by controlling what data is collected before it reaches your account.
Matomo Cloud billing is based on the number of hits recorded. A hit is not limited to page views as it includes every tracked interaction such as an event, download, site search, or content impression. For a detailed explanation on what qualifies as a hit, refer to the guide on What are hits?
These tracked interactions count towards your quota, regardless if it is from a real visitor, a bot, or internal traffic. Only pre-ingestion filtering can reduce hits by blocking unwanted requests before they are tracked, which helps to conserve your quota and avoid unexpected overage fees.
This guide explains what affects your quota, what doesn’t, and how to implement pre-ingestion traffic filtering.
What can reduce my quota (pre-ingestion filtering)?
The following methods can block unwanted traffic across all your websites before it is recorded in Matomo. While it is possible to configure filtering at a website level, applying the filtering globally (across all your sites) is recommended when your goal is to protect quota. Global exclusions ensure filtering is applied consistently across all sites, reducing unnecessary hits before they count toward your usage.
1. Exclude IP addresses and ranges
You can block specific IP addresses or IP ranges, so that hits originating from these sources, such as an internal team, are not tracked. This ensures visits from those IPs never count towards your quota.
To set this up, go to Matomo settings (Administration) > Settings > Measurables or Websites > Global list of excluded IPs.
2. Exclude user agents (using regex)
You can exclude visits based on the browser’s user agent string, which is the identifier that tells Matomo the type of browser, device, or tool that is sending the request. This is especially useful for blocking bots and scrapers that you don’t want tracked.
Configure the exclusion list under Matomo settings (Administration) > Settings > Measurables or Websites > Global list of excluded user agents. For example, to exclude the following:
- Empty user agents (very common with junk traffic): use
/^$/
- Generic bots, spiders, and crawlers (standard identifiers in user agents): use
/bot|spider|crawl|scanner/i
It is recommended to start with safe exclusions and monitor your Visitors > Visits Log. If you notice other suspicious user agents consuming your quota, add more patterns to exclude them from tracking.
3. Block tracking in specific folders (JavaScript logic)
If there are sections of your site that you do not want to count toward your quota, e.g, admin tools, or large media directories, you can add conditional logic to your tracking setup. For example, you can configure Matomo to skip tracking whenever the page path begins with /internal/
or /media/
. This ensures that hits from non-public sections are never recorded in Matomo.
You can define which folders to exclude by editing the Matomo tracking code in your web pages, e.g., include a path check before loading matomo.js
or calling trackPageView
.
//EXAMPLE JAVASCRIPT LOGIC
<script>
(function () {
var excludedPrefixes = ['/internal', '/staging', '/admin']; // adjust as needed
var path = window.location.pathname || '/';
var isExcluded = excludedPrefixes.some(function (p) { return path.indexOf(p) === 0; });
if (isExcluded) { return; } // do not load or call Matomo on these paths
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u = "//YOUR_DOMAIN.matomo.cloud/"; // update
_paq.push(['setTrackerUrl', u + 'matomo.php']);
_paq.push(['setSiteId', 'YOUR_SITE_ID']); // update
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.async = true; g.src = u + 'matomo.js'; s.parentNode.insertBefore(g, s);
})();
})();
</script>
4. Block spam and bot traffic with Tracking Spam Prevention
The Tracking Spam Prevention feature can be configured for additional traffic filtering. The following filtering methods are described in the guide, Block spam and bot traffic with Tracking Spam Prevention.
- Block known cloud providers.
- Block headless browsers.
- Block requests from server-side libraries.
- Limit tracked actions per visit.
- Exclude countries or only track visitors from specific countries.
This feature is included in Matomo Cloud and configured in Matomo settings (Administration) > System > General Settings > Tracking Spam Prevention.
What does NOT reduce my quota?
Some filtering methods only take effect after data has been ingested into Matomo. Because billing is based on the number of hits collected, these filtering methods will not reduce your quota usage or costs. They are useful for refining reports and analysis but do not prevent hits from being counted.
- Segments: You can apply segments to view different reports but it does prevent hits from being recorded.
- JavaScript conditions defined after trackPageView: If you add logic in your tracking code or in Tag Manager after the trackPageView call, the request will still be sent to Matomo. The hits are ingested and counted towards your quota.
Note: Only when logic is placed beforetrackPageView
(or before the tracker loads at all), the request is never sent and will count as pre-ingestion filtering. - Report filters: These filters only change what data appears in reports or how it is displayed. These filters do prevent hits from being counted.
- Tag Manager filters: Filters applied after the tracking request only refine analysis and do not reduce quota.
Note: Matomo Tag Manager can be configured to track only specific events or be disabled on certain pages or folders to prevent any request from being sent. - Goal/Conversion exclusions: Excluding a goal or conversion only changes what appears in your reports, it does not affect how hits are counted. For example, you could set a rule to ignore conversions from internal testers or specific campaigns. The conversions will not show up in your goal reports, but the underlying pageviews, events, or Ecommerce actions that triggered them are still tracked.
Even if these methods hide or exclude certain traffic in reports, the hits still count toward your quota and will affect billing. To reduce quota usage, only pre-ingestion filtering methods are effective.
Recommendations to protect Cloud quota
To keep your Matomo Cloud quota optimised and avoid unnecessary overage fees, review the following recommendations to manage your Matomo Cloud quota and reduce the risk of unexpected overage fees:
- Configure the Tracking Spam Prevention settings to block traffic from bots, scrapers, and cloud providers.
- Exclude empty user agents (
/^$/
) to remove junk traffic with no impact on real visitor reports. - Monitor the Visits Log for suspicious IPs or fake browsers, then block abusive IP addresses or ranges.
- Gradually block abusive user agents (e.g, Chrome/135.0 or headless sessions). Start with the safest options, then expand to stricter rules if you know it will not affect legitimate traffic.
- Set a maximum actions per visit limit (e.g, 100) to cut off abusive sessions that generate excessive hits.
- Review the section, What does NOT reduce my quota? to avoid relying on filters or segments that only affect reports after hits are ingested.
Special case: DDoS or abnormal traffic spikes
If your website experiences a sudden surge of traffic due to a DDoS attack or other malicious activity, this traffic will still count against your Matomo Cloud quota once it reaches our servers. Matomo is not a DDoS protection service, so we cannot absorb or block such traffic on your behalf. We strongly recommend setting up protective measures on your website or infrastructure (such as Cloudflare, AWS Shield, or Google Cloud Armor) so that unwanted requests are blocked before they are sent to Matomo. Quota consumption cannot be reversed once the data has been ingested.
We also recommend monitoring your traffic patterns regularly and acting quickly when suspicious spikes appear. To reduce the risk of junk traffic consuming quota in the future, apply pre-ingestion filtering to exclude known bad traffic (e.g, filtering based on IP ranges, user agents, or referrers). These filters only apply to new data and will not retroactively remove traffic that has already been processed. If a spike has already occurred, you can delete the unwanted visits from your reports to keep your analytics clean.
Example configuration with pre-ingestion traffic filtering
1. Enable Tracking Spam Prevention settings
Tracking Spam Prevention (for bot filtering) is included in Matomo Cloud plans and fully configurable.
2. Define exclusion lists
Set up the exclusion lists for specific IP addresses/ranges and suspicious user agents in Matomo settings (Administration) > Settings > Measurables or Websites > Global list of Excluded IPs and Global list of user agents to exclude.
Suggested safe regexes for user agents:
- Empty user agents:
/^$/
- Headless browsers:
/HeadlessChrome/
- Known scrapers:
/curl|wget|httpclient/i
Managing your Matomo Cloud quota starts before data is recorded. By applying pre-ingestion filtering, you can block junk traffic, internal visits, and other irrelevant hits so they never count toward your usage. This keeps your reports focused on real visitors and ensures you get the best value from your Matomo Cloud plan.
Remember: If a hit is sent to Matomo, it counts. Only exclusions made before ingestion will protect your quota.
Frequently asked questions
Why don’t my filters reduce my quota?
Because filters such as segments, tags, or cookies apply only after data is ingested. They refine analysis but do not prevent hits from being counted.
Why am I paying for bot traffic?
Quota billing counts all ingested hits including bots, scrapers, and junk traffic unless they are excluded before ingestion.
How can I stop paying overages for junk traffic?
Use pre-ingestion filtering methods such as IP exclusions, user agent exclusions, or Tracking Spam Prevention settings. These stop hits before they are logged and billed.
Can I block junk traffic after it happens?
No. Once hits are ingested, they count towards your quota.
Can I undo hits from bots after billing?
No. Hits cannot be removed from your quota once collected. Only pre-ingestion exclusions reduce billing.