Shield Types
All shield rules support two actions:- Deny: Block traffic matching the rule (default)
- Allow: Explicitly permit traffic matching the rule
Shield rules are cached for performance and updated automatically when you make changes.
IP Address Blocking
Block or allow traffic from specific IP addresses to filter out internal traffic, bots, or unwanted visitors.Creating IP Rules
Add IP Address
Enter the IP address you want to block or allow:
- IPv4:
192.168.1.1 - IPv6:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Add Description (Optional)
Add a description to remember why you created this rule, such as “Office IP” or “Known bot”.
IP Rule Details
Common Use Cases
Block office traffic:Country Filtering
Block or allow traffic from entire countries using ISO country codes.Creating Country Rules
Select Country
Choose a country from the dropdown or enter its 2-letter ISO code (e.g., US, GB, FR).
Country Rule Schema
Country Codes
- Use standard 2-letter ISO country codes (ISO 3166-1 alpha-2)
- Special code:
ZZrepresents unknown/undetected countries
The country code must be exactly 2 characters and match a valid ISO country code.
Example Rules
Block specific country:Country detection is based on the visitor’s IP address. VPNs and proxies may affect accuracy.
Page Path Filtering
Filter traffic based on page paths using exact matches or wildcard patterns.Creating Page Rules
Wildcard Patterns
Page rules support wildcard matching:*- Matches any characters in a single path segment**- Matches any characters across multiple path segments
| Pattern | Matches | Doesn’t Match |
|---|---|---|
/admin | /admin | /admin/users |
/admin/* | /admin/users, /admin/settings | /admin/users/edit |
/admin/** | /admin/users, /admin/users/edit/123 | /api/admin |
/blog/*/comments | /blog/post-1/comments | /blog/nested/post/comments |
Page Rule Schema
Page patterns are automatically compiled to regular expressions for efficient matching.
Validation Rules
- Page paths must start with
/ - Maximum length: 250 characters
- Pattern must compile to a valid regular expression
Common Use Cases
Exclude admin pages:Hostname Allowlist
Control which hostnames can send events to your site. This is an allowlist-only feature (default action isallow).
Creating Hostname Rules
Add Allowed Hostname
Enter the hostname that should be allowed to send events.Examples:
example.com*.example.comapp.example.com
Wildcard Support
Hostname rules support wildcard patterns:example.com- Matches exactlyexample.com*.example.com- Matches all subdomains**- Matches any hostname (not recommended)
| Pattern | Matches | Doesn’t Match |
|---|---|---|
example.com | example.com | www.example.com |
*.example.com | app.example.com, api.example.com | example.com |
www.example.com | www.example.com | example.com |
Hostname Rule Schema
Hostname shields prevent event spoofing by ensuring events only come from your legitimate domains.
Use Cases
Allow main domain and www:Shield Performance
All shield rules are cached for optimal performance:- IP rules use
Plausible.Shield.IPRuleCache - Country rules use
Plausible.Shield.CountryRuleCache - Page rules use
Plausible.Shield.PageRuleCache - Hostname rules use
Plausible.Shield.HostnameRuleCache
Caches are automatically updated when you add, modify, or remove shield rules.
Managing Shield Rules
Viewing Active Rules
See all active shield rules for your site:- Navigate to Site Settings > Shields
- View rules organized by type
- See who added each rule and when
Editing Rules
To modify a rule:- Remove the existing rule
- Create a new rule with updated settings
Shield rules cannot be directly edited. Delete and recreate the rule with your desired changes.
Removing Rules
Delete a shield rule:- Find the rule in your shields list
- Click the delete/remove button
- Confirm removal
Best Practices
Use Specific Patterns
Make page and hostname patterns as specific as possible to avoid over-filtering.
Troubleshooting
Rule not working?- Verify the pattern syntax is correct
- Check that the rule action (deny/allow) is what you intended
- Wait a few moments for cache updates to propagate
- Review your wildcard patterns
- Remove overly broad rules
- Consider using more specific patterns
- Ensure page paths start with
/ - Check pattern length (max 250 characters)
- Verify the pattern compiles to valid regex