How to block or allow visitors with rules
What it does
Section titled “What it does”Rules on the Rules page block or allow visitors you choose, before your protection mode is applied. There are five types:
- IP addresses: one address, or a range such as 203.0.113.0/24.
- Countries: block visitors from the countries you list, or allow only visitors from them.
- Regions: the same for regions, such as states and provinces, inside a country.
- User agents: visitors whose user agent contains some text, such as python-requests.
- URL parameters: visitors who arrive on a link with a parameter you name, such as ?utm_source=clickfarm-net.
For each rule you can also choose:
- Block or Always allow (IP addresses, user agents and URL parameters). Always allow skips every other rule and your protection mode.
- What blocked visitors get: Show the block page, or Redirect to a page or URL.
- Where it applies: Whole store, or Chosen pages only (products, collections or paths).
- A Note that only you see.
When to use it
Section titled “When to use it”- One IP address or network keeps hitting your store: block it.
- You don’t sell to some countries, or only sell to a few: use a country list.
- You only serve some states or provinces: use a region list set to Allow only.
- A scraper sends a recognisable user agent: block that text.
- Bot clicks arrive from a bad ad placement or referral tag: block the URL parameter it carries.
- A partner’s tool or your office keeps getting blocked: add an Always allow rule for its IP address.
- You want to protect only some pages, such as a wholesale page or a limited drop: use Chosen pages only.
Where to find it
Section titled “Where to find it”- Rules > IP addresses, Countries, Regions, User agents or URL parameters tab
- Rules > Add rule, Add country or Add region (the button changes with the tab)
- In the rule form: Type, Rule (Block or Always allow), Blocked visitors (Show the block page or Redirect to a page or URL), Applies to (Whole store or Chosen pages only), Note (optional, only you see it)
- Countries and Regions tabs > Country rules or Region rules list setting
- A rule’s menu > Edit or Delete. On the Countries and Regions tabs, click a name to edit it, or its remove button to remove it.
- Search above the list on the IP addresses, User agents and URL parameters tabs.
- From the Visitor log, a row’s Block this IP… or Allow this IP… opens the rule form filled in.
Limits
Section titled “Limits”Your plan sets how many rules you can add, all types together. When you reach it, the page says so.
Add a rule
Section titled “Add a rule”- On the Rules page, open the tab for the type of rule, and click Add rule (or Add country, Add region).
- Fill in the rule. The fields depend on the Type.
- Choose Block or Always allow, what blocked visitors get, and where it applies.
- Click Save rule. It applies from each visitor’s next page view, including visitors who were already let in.
IP addresses
Section titled “IP addresses”Enter one address, or a range such as 203.0.113.0/24, in IP address or range. Choose Block or Always allow.
Countries and regions
Section titled “Countries and regions”Countries and regions are lists. Each list has a setting at the top:
- Block visitors from the countries listed (or regions): everyone else gets in.
- Allow only visitors from the countries listed. Everyone else sees your block page. For regions, only visitors from other regions of the same countries are blocked; other countries are left to your country list.
Good to know:
- Changing the list setting asks you to confirm first, because it changes who’s blocked at once.
- A list set to Allow only with nothing in it blocks no one. Add at least one.
- Entries in an Allow only list always apply to the whole store.
- Countries and regions have no Always allow. To let one place in, use an Allow only list.
- If both lists are set to Allow only, a region whose country isn’t in your country list stays blocked, and the page warns you.
- For a region, choose the Country first, then the Region. If our location data has no regions for a country, use a country rule instead.
- Location comes from the visitor’s IP address. A shopper travelling abroad appears in the country they’re visiting, and a VPN user appears where their VPN is.
- Search engines are always allowed, wherever they crawl from. Googlebot mostly crawls from the US, and it still gets through.
User agents
Section titled “User agents”Enter text in User agent contains. It matches anywhere in the visitor’s user agent, and isn’t case sensitive. Use text only the bot sends, such as python-requests.
Always allow on a user agent is your call, but the form warns you: anyone can put any text in their user agent, so a bot can copy it. A visitor whose user agent contains the text skips every rule and your protection mode.
URL parameters
Section titled “URL parameters”URL-parameter rules match the link a visitor arrives on:
- Enter the Parameter name, such as utm_source.
- Choose a Match: Is, Contains or Is present (any value).
- Enter the Value, such as clickfarm-net. Not case sensitive.
The rule matches a visitor arriving on a link like yourstore.com/?utm_source=clickfarm-net. Always allow works here too, with the same warning: anyone can add a parameter to a link.
Block page or redirect
Section titled “Block page or redirect”For a block rule, choose what blocked visitors get under Blocked visitors:
- Show the block page: your block page.
- Redirect to a page or URL: enter a page on your store, such as /pages/contact, or a full address starting with https:// in Redirect to. These visits show as Redirected in the visitor log.
Whole store or chosen pages
Section titled “Whole store or chosen pages”Under Applies to, choose Whole store, or Chosen pages only and then:
- Add products or Add collections to pick them from your store.
- Or add a path, such as /pages/wholesale, and click Add. A path covers the page and everything under it, in every language.
You can choose up to 50 pages per rule.
What rules don’t change
Section titled “What rules don’t change”- Verified search engines, such as Googlebot, are never blocked by a rule. Only the switches on the Bot protection page can block them. See Good bots and bad bots.
- Bypass links get their holder past every rule. See How to use bypass links.
- In watch mode, rules log visits as Watched instead of blocking or redirecting them.