RUMvision lab

Speculation Rules Builder

A builder widget for Speculation Rules. During testing or implementation, DevTools can be used to debug your implementation.

Your changes are saved automatically on this device and in this browser, and will be available when you return to this page as long as your local storage is preserved.

Add rule

prefetch: fetch a document ahead of time, but not its subresources like CSS or JS.
A hint to the browser as to how eagerly it should prefetch/prerender link targets
default: list ("urls") rules default to immediate and document ("where") rules default to conservative when no eagerness was provided.
Chrome limits:
Max 2 kept in memory.
Canceled speculation can be triggered again, pushing out oldest speculation.
Add multiple URLs. They will appear below.
Where conditions

Your rules

No rules added (yet).

Add a or

Preferred implementation

Script tag with type=speculationrules allows for embedding in your HTML or template files
JS inject is convenient for:
  • testing the result in DevTools Console without deploying it yet
  • deploying it via GTM Custom HTML (hence using var)
  • changing rules during the page life cycle (SPA navigation, A/B tests, logged-in vs logged-out)
  • cancellation or refreshing of speculation rules

Generated JSON

Generated JSON

Start from scratch

How would you like to start setting up your Speculation Rules?

Paste Speculation Rules JSON

Both including or excluding <script> tags is supported.