Exclude Your Own Visits, Bots and Specific Traffic
Applies to SlimStat 5.5.0 · checked
SlimStat excludes your own visits from Settings, Exclusions tab, at admin.php?page=slimconfig&tab=4, where fifteen settings filter traffic by WordPress user, capability, IP range, country, language, user agent, operating system, permalink, referrer and content type. Every rule runs inside the tracker, so excluded traffic is never written to the database.
Which Exclusion Setting To Use
The Exclusions tab holds two sections: User Properties carries eleven settings about who is visiting, and Page Properties carries four settings about what is being requested. Toggles take no value, and every textarea is a comma-separated list whose entries are trimmed of surrounding spaces.
| Traffic to exclude | Setting key | UI label | Field accepts |
|---|---|---|---|
| All logged-in WordPress users | ignore_wp_users | WP Users | Toggle, no by default |
| A role or capability | ignore_capabilities | Capabilities | Capability keys or role slugs, wildcards allowed |
| Named accounts | ignore_users | Usernames | Usernames, wildcards allowed, spaces are significant |
| Office or home connection | ignore_ip | IP Addresses | CIDR ranges, for example 192.168.0.0/24 |
| Crawlers and search bots | ignore_bots | Bots | Toggle, ships off |
| Known spam commenters | ignore_spammers | Spammers | Toggle, on on new installs |
| Prefetch and preview hits | ignore_prefetch | Prefetch Requests | Toggle, on on new installs |
| Whole countries | ignore_countries | Countries | Lowercase ISO 3166-1 codes, no wildcards |
| Browser languages | ignore_languages | Languages | Lowercase ISO 639-1 codes, no wildcards |
| Specific browsers | ignore_browsers | User Agents | Browser names, optional /version, wildcards allowed |
| Operating systems | ignore_platforms | Operating Systems | Platform codes, wildcards allowed |
| Individual pages | ignore_resources | Permalinks | Paths such as /about or ?p=1, wildcards allowed |
| Referring sites | ignore_referers | Referring Sites | Full URLs, protocol required, wildcards allowed |
| Content types | ignore_content_types | Content Types | post, page, 404, feed, cpt:product |
| Clicks on marked links | do_not_track_outbound_classes_rel_href | Link Attributes: class names, REL and HREF | noslimstat,ab-item by default |
The Order SlimStat Applies Exclusions
SlimStat evaluates exclusions in one fixed order inside src/Tracker/Processor.php, returning a numbered tracker code the moment a rule matches and skipping everything below it. IP addresses are the first Exclusions setting tested, ahead of permalinks, referrers, users, countries and bots, so a matching CIDR range makes every later setting irrelevant.
| Rule that stops the pageview | Tracker code |
|---|---|
slimstat_filter_pre_tracking returned false | none |
| Consent denied by a CMP or GDPR settings | 301 |
ignore_ip | 304 |
ignore_resources | 305 |
ignore_referers | 306 |
ignore_content_types | 307 |
ignore_wp_users, ignore_capabilities, ignore_users | 309 |
ignore_spammers | 317 |
ignore_languages | 310 |
ignore_countries | 311 |
ignore_prefetch | 312 |
ignore_bots | 313 |
ignore_browsers | 314 |
ignore_platforms | 315 |
Code 311 fires only while a geolocation provider is active and consent permits personal data, because SlimStat reads the visitor country inside that same guard. With geolocation disabled in the geolocation setup, the Countries field never matches anything.
How Each Field Is Parsed
Seven textareas are split on commas and then matched by Utils::isBlacklisted(), which anchors each pattern to the start and end of the value and compares case-insensitively: Usernames, Capabilities, Permalinks, Referring Sites, Content Types, User Agents and Operating Systems. An entry must equal the whole value unless you add a wildcard.
*stands for any string including an empty one, souser*matches user12 and userfoo.!stands for a single character, souser!0matches user10 and user90.- Countries and Languages skip that engine entirely and run a case-insensitive substring search, which is why wildcards are documented as unsupported there.
ignore_ipcompares CIDR ranges such as54.12.0.0/16against both the public IP and the originating IP, and a bare address is treated as/32for IPv4 or/128for IPv6.
Exclude Yourself And Your Team
Setting ignore_wp_users to on drops every logged-in WordPress account, on the front end and in the backend, and the shipped value is no, so a fresh install does record your own visits. Leave the toggle off when you want only some accounts excluded.
- Open SlimStat, click Settings, then open the Exclusions tab.
- Switch WP Users to on to exclude every logged-in account.
- Enter individual logins in Usernames to exclude only certain accounts.
- Enter
manage_optionsin Capabilities to exclude everyone who can administer the site. - Add your office range to IP Addresses in CIDR form, such as
203.0.113.0/24. - Click Save Changes.
- Reload a public page as that user and check the Real-time report.
Capabilities matches role slugs as well as capability keys, so editor and edit_posts both exclude an editor. Saving the Exclusions tab needs the capability named under Access Control, Settings, Minimum Capability, which is manage_options until you change it.
Excluding Traffic In Code
slimstat_filter_pre_tracking receives a boolean in wp-slimstat.php while the plugin loads, and returning false stops SlimStat registering the tracker for that request, before any Exclusions setting is read. SlimStat already passes false for its own internal endpoints, so return the incoming value whenever your own condition does not apply.
add_filter('slimstat_filter_pre_tracking', function ($is_tracking) {
return $is_tracking && empty($_GET['preview']);
});
The slimstat_filter_pre_tracking reference carries the full signature. Two later hooks drop an already-collected pageview when a callback returns an empty array: slimstat_filter_pageview_stat_init records code 302, and slimstat_filter_pageview_stat records code 316.
Confirming An Exclusion Fired
SlimStat stores the last tracker outcome under Settings, Maintenance tab, in the Troubleshooting section labelled Tracker Error, as a timestamp plus the numeric code. Code 304 means an IP matched, 309 a WordPress user, 313 a bot and 311 a country. The Reset this error link beside the message clears the record.
The Tracker Error record is rewritten at most once every 900 seconds while the code stays the same, so the timestamp will not advance on every excluded hit. Tracking Mode set to Client also weakens bot filtering, because crawlers that run no JavaScript send no request for ignore_bots to reject; the tracker troubleshooting checklist covers that mode in detail.