Advanced Prefetch Rules
Fine-tune exactly which pages are prefetched and which are ignored using Speculation Rules.
Rule Types
When creating a new rule in the Settings tab of your dashboard, you can specify an Action and a Condition.
Prefetch
Force prefetching for URLs matching the condition. Useful for whitelisting specific paths or ensuring critical flows are always fast.
Exclude
Prevent prefetching for URLs matching the condition. This is the most common use case for advanced rules.
Common Exclusion Use Cases
- Logout Links: Prevent accidental logouts by excluding paths like
/logoutor/sign-out. - Admin Areas: Keep analytics clean and server load low by excluding
/admin/*or/dashboard/*. - "Add to Cart" Links: If your store uses GET requests for cart actions, exclude patterns like
*?add-to-cart=*.
Complex Conditions
The Condition Builder allows you to create sophisticated logic using AND, OR, and NOT groups.
- URL Pattern: Simple wildcards (e.g.,
/blog/*). - URL Regex: Regular expressions for precise matching (e.g.,
^/products/\d+$).
Example: Complex Exclusion
Exclude all account pages BUT allow the profile page:
- Set Action to Exclude.
- Create an AND Group.
- Condition 1: URL Pattern matches
/account/*. - Condition 2: NOT → URL Pattern matches
/account/profile.
Device Targeting
You can limit any rule to specific device types: Mobile, Tablet, or Desktop.
For example, you might want to be more aggressive with prefetching on Desktop (where bandwidth is plentiful) but exclude heavy pages on Mobile to save data.
To do this, simply uncheck the devices you want to exclude when creating a rule.