Ignore specific countries from reporting? #4000
Replies: 1 comment
-
|
Umami doesn't have a built-in "ignore by country" filter, but here are a few ways to handle this: 1. Find the IPs from your server logs and use Even though Umami doesn't show IPs in the dashboard, your reverse proxy logs every request. Look at requests to # Nginx example - find high-frequency IPs
grep "/api/send" /var/log/nginx/access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head -20The bot IPs from Germany will stand out as high-frequency. Then set: IGNORE_IP=1.2.3.4,5.6.7.82. Block at the reverse proxy by GeoIP If you're using Nginx with the GeoIP2 module, you can block specific countries from hitting the tracking endpoint: # Only block the tracking endpoint, not the dashboard
location /api/send {
if ($geoip2_data_country_iso_code = "DE") {
return 403;
}
proxy_pass http://umami:3000;
}But be careful with this — it blocks ALL German traffic including real visitors. Only use this if you're certain you have zero real German audience. 3. Rate limit the collection endpoint (recommended) This is often the best solution for bot traffic since legitimate users won't hit the tracking endpoint more than a few times per minute: limit_req_zone $binary_remote_addr zone=umami:10m rate=10r/s;
location /api/send {
limit_req zone=umami burst=20 nodelay;
proxy_pass http://umami:3000;
}I'd start with option 1 to identify the specific IPs, then add rate limiting as a long-term defense. The pattern you're seeing (uniform visits across many pages from one country) is classic bot behavior. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm looking for if there is a way to ignore visits from specific countries.
My reason for this is because I'm having a lot of visits from Germany which are clearly bot visits (see screenshot).
I see in the docs you can ignore by IP (https://umami.is/docs/environment-variables#ignore_ip) but is there a way I can ignore by country?
I would use IP ignore, but I'm not sure how to get the IPs or the visitors in this case because they're not tracked.
Beta Was this translation helpful? Give feedback.
All reactions