Advanced Traffic Filtering in BATracker: Rules, Templates & Setup
Every wasted click costs money. BATracker's filtering engine gives you precise, real-time control over exactly which visitors reach your offers — and which get blocked, redirected, or flagged before they ever touch your budget. This is the complete technical setup guide.
1. How BATracker Filtering Works
Filtering in BATracker happens at the edge, before a visit is counted. Because BATracker runs on a modern Fastify (Node.js) tracker backed by ClickHouse and Redis, filter evaluation adds effectively nothing to BATracker's sub-10ms redirects. A filter is a simple, powerful equation: pick a filter type (what to inspect), an operator (how to compare), a value, and an action (what to do on a match).
Rules are evaluated in order and the first matching rule wins. If no rule matches, the click is allowed by default. That single principle — first match wins, no match means pass — is the mental model you need for everything below. Order your rules from most specific to most general, and put your explicit whitelists early.
The anatomy of a BATracker filter rule:
FILTER TYPE + OPERATOR + VALUE → ACTION
2. Every Filter Type (Grouped by Category)
BATracker exposes a rich set of dimensions to filter on — from geography and device to connection quality, bot status, and your own tracking fields. Here they are, grouped by category:
| Category | Filter Types | What It Inspects |
|---|---|---|
| Geography | COUNTRY, CITY, REGION | Visitor location from GeoIP. |
| Network | ISP, DATACENTER, CONNECTION_TYPE, PROXY, IP | ISP name, datacenter/proxy flags, connection type, and IP address. |
| Device | DEVICE / DEVICE_TYPE, OS, BROWSER | Desktop, mobile, tablet, smarttv, wearable; OS and browser. |
| Client | LANGUAGE, USER_AGENT | Browser language and the raw user agent string. |
| Source | REFERRER, REFERRER_DOMAIN | Full referrer URL or just the referring domain. |
| Behavior | CLICKS_PER_IP, BOT_STATUS | Click frequency per IP and automatic bot classification. |
| Tracking | EXTERNAL_ID, TRACKING_FIELD_1..20 | Your external ID and sub1–sub20 custom parameters. |
| Time | WEEKDAY, TIME_OF_DAY | Day of week and hour of day, in the campaign timezone. |
Note that DATACENTER, PROXY, and BOT_STATUS are boolean dimensions — they are either true or false — which makes them ideal for one-line blocking rules. TRACKING_FIELD_1 through TRACKING_FIELD_20 map directly to sub1–sub20, so you can filter on any parameter your traffic source passes, such as a placement, zone, or campaign ID.
3. Every Operator
Operators define how the filter value is compared. BATracker supports text matching, list membership, numeric comparisons, IP ranges, regex, and emptiness/boolean checks:
| Category | Operators | Use For |
|---|---|---|
| Equality | is / equals, is_not | Exact matches (e.g. COUNTRY is US). |
| Substring | contains, not_contains, starts_with, ends_with | Partial text matches on user agents, referrers, sub IDs. |
| List | in_list, not_in_list | Multi-country or multi-value allow/deny lists. |
| Numeric | greater_than, less_than, greater_than_or_equals, less_than_or_equals, between, not_between | CLICKS_PER_IP thresholds and time ranges. |
| IP Range | in_range | CIDR blocks such as 192.168.0.0/24. |
| Regex | regex, not_matches_regex | Pattern matching (capped at 500 chars for ReDoS safety). |
| Emptiness | is_empty, is_not_empty | Missing referrers, empty sub IDs, blank user agents. |
| Boolean | is_true, is_false | DATACENTER, PROXY, and BOT_STATUS checks. |
The regex cap at 500 characters is a deliberate ReDoS (regular expression denial-of-service) safeguard — BATracker protects its own redirect performance so a runaway pattern can never slow down your traffic. For most blocking needs, contains, in_list, and in_range are faster to reason about than regex anyway.
4. Actions: BLOCK, REDIRECT, ALLOW, FLAG
When a rule matches, its action decides what happens to the visitor. BATracker gives you four:
BLOCK
Returns a 404, logs the click as filtered, and does NOT consume your visit quota. The ideal action for bots, datacenters, and proxies — you protect both your data and your plan usage.
REDIRECT
Sends a 302 to a fallback URL and logs the click as filtered. Use it to route unwanted traffic to a safe page, a backup offer, or your own site instead of the primary offer.
ALLOW
An explicit whitelist. Because the first matching rule wins, an early ALLOW rule guarantees a trusted segment passes before any later BLOCK rule can catch it.
FLAG
Allows the visitor through but marks the click for review. Perfect for suspicious-but-uncertain traffic you want to monitor before deciding to block it outright.
The fact that BLOCK returns a 404 and does not consume your visit quota is a genuine edge: aggressive filtering in BATracker saves plan usage rather than wasting it. Every bot you block is a visit you keep.
5. Templates vs Inline Filters
BATracker supports two layers of filtering, and understanding how they interact is key to a clean setup.
Filter Templates
Reusable rule sets you build once and share across campaigns. Each template has a status:
- • ACTIVE — enforced on every campaign it is attached to.
- • PAUSED — temporarily disabled without deleting.
- • ARCHIVED — retired but kept for reference.
Inline Filters
Configured per-campaign, and they take precedence over templates. Use inline rules for campaign-specific exceptions — for example, allowing a geo that your global template would otherwise block.
The recommended pattern: build one ACTIVE template with your universal defenses (BOT_STATUS, DATACENTER, PROXY) and attach it everywhere, then layer thin inline rules on individual campaigns for one-off targeting. Remember: across both layers, the first matching rule wins, and no match means the click is allowed.
6. Dayparting & Time Filters
The WEEKDAY and TIME_OF_DAY filter types let you restrict traffic to specific days and hours — classic dayparting to cut spend during hours that never convert. The critical detail: time filters evaluate in the campaign's timezone (IANA, default UTC), using Intl-based date parts.
This means dayparting matches exactly what you configured in the campaign — not the server clock. Set a campaign to America/New_York and a 9-to-5 window means 9-to-5 Eastern, every time, with no manual UTC math.
To restrict traffic to business hours, use TIME_OF_DAY between 09:00 and 17:00 — or invert it with not_between to block those hours. Combine WEEKDAY with in_list to run only on weekdays.
7. Practical Recipes
Here are copy-paste-ready rule patterns for the most common filtering goals. Each follows the same shape: filter type + operator + value → action.
Allow only specific countries
Add an early ALLOW rule: COUNTRY in_list US, CA, GB. Then add a catch-all BLOCK rule: COUNTRY not_in_list US, CA, GB → BLOCK. First match wins, so allowed geos pass and everything else is blocked.
Block datacenters and proxies
Two boolean rules: DATACENTER is_true → BLOCK and PROXY is_true → BLOCK. Real users almost never come from AWS, Google Cloud, Azure, OVH, Hetzner, or similar hosts, so this cuts obvious non-human traffic instantly.
Block detected bots
BOT_STATUS is_true → BLOCK. BATracker automatically classifies crawlers, scrapers, headless browsers, CLI tools (curl, wget, python-requests), search-engine bots, social preview bots, SEO crawlers, and AI crawlers (GPTBot, ClaudeBot) from the user agent — an empty user agent is treated as a bot too.
Throttle repeated clicks from one IP
CLICKS_PER_IP greater_than 5 → BLOCK. This catches the same address hammering your link — refreshers, click bots, and misconfigured sources — without penalizing normal shared-network traffic. Tune the threshold to your traffic profile.
IP CIDR blocklists
IP in_range 192.168.0.0/24 → BLOCK. Use CIDR notation to blackhole an entire range of known-bad addresses in a single rule instead of listing them one by one.
Regex user-agent blocks
USER_AGENT regex (curl|wget|python-requests) → BLOCK. For surgical control over specific tools or fingerprints. Patterns are capped at 500 characters for ReDoS safety, which keeps your redirects fast.
Dayparting to business hours
TIME_OF_DAY between 09:00 and 17:00 → ALLOW, with a following TIME_OF_DAY not_between 09:00 and 17:00 → BLOCK. Evaluated in the campaign timezone, so it stops the after-hours spend that never converts.
| Goal | Filter Type | Operator + Value | Action |
|---|---|---|---|
| Geo allow-list | COUNTRY | in_list US, CA, GB | ALLOW |
| Kill datacenters | DATACENTER | is_true | BLOCK |
| Kill proxies/VPNs | PROXY | is_true | BLOCK |
| Kill bots | BOT_STATUS | is_true | BLOCK |
| Rate-limit IPs | CLICKS_PER_IP | greater_than 5 | BLOCK |
| CIDR blocklist | IP | in_range 192.168.0.0/24 | BLOCK |
| Dayparting | TIME_OF_DAY | not_between 09:00–17:00 | BLOCK |
8. Frequently Asked Questions
What is the difference between filter templates and inline filters in BATracker?
Does a blocked click count against my visit quota in BATracker?
How do I block traffic from datacenters, proxies, and bots?
Can I set up dayparting with BATracker traffic filters?
How do I block a range of IP addresses in BATracker?
Stop Paying for Bots, Datacenters & Proxies
BATracker's filtering engine blocks junk traffic before it counts — 404 on block, zero visit quota consumed, evaluated in real time at sub-10ms speed. Build one template, protect every campaign.
Start Your Free Trial