Skip to content

Smart Speculation

Browser pre-render the next page. We predict it for you and load it before the click.

The Speculation Rules API is a browser feature that lets a web server tell the browser: "the user is likely to visit this URL next — load it now." When the user clicks the link, the page is already rendered and ready. The navigation is instantaneous.

Accelerate Guru injects Speculation Rules automatically into every Magento page, tuned for the typical Magento navigation funnel: homepage → category → product → cart → checkout.


#What Speculation Rules are

The Speculation Rules API is a W3C specification (shipped in Chrome 109, Edge 121) that allows pages to declare lists of URLs for the browser to:

  • Prefetch — download the HTML in the background (fast, low resource cost).
  • Prerender — fully render the page in a background tab, including JavaScript execution (slower, high resource cost, but instantaneous navigation).

Unlike <link rel="prefetch">, Speculation Rules are adaptive — the browser may choose not to execute them if device memory is low, the connection is slow (Save-Data header), or the battery level is critical. The server declares intent; the browser decides execution.

#Browser support (2026)

BrowserPrefetchPrerender
Chrome 109+YesYes
Edge 121+YesYes
FirefoxNo (prefetch via <link> instead)No
SafariNoNo

Coverage: approximately 70% of desktop and 55% of mobile traffic. For the remaining browsers, the feature degrades gracefully — the <script type="speculationrules"> tag is ignored, and navigation works normally.


#How Accelerate Guru injects Speculation Rules

On every cacheable HTML response, Accelerate Guru injects a <script type="speculationrules"> block before </body>. The content is dynamically generated based on the current page type (homepage, category, product, cart) and your configuration:

<script type="speculationrules">
{
  "prerender": [
    {
      "source": "list",
      "urls": [
        "/catalog/category/view/id/42",
        "/catalog/category/view/id/17"
      ],
      "eagerness": "moderate"
    }
  ],
  "prefetch": [
    {
      "source": "document",
      "where": {"href_matches": "/catalog/product/view/*"},
      "eagerness": "moderate"
    }
  ]
}
</script>

#Eagerness modes

The eagerness setting in [optimization_speculation] controls when the browser acts on the hints:

ModeTriggers onResource costWhen to use
conservativeExplicit user gesture (click or tap)Very lowStores with limited server capacity
moderateMouse hover over link (200ms)MediumDefault — recommended for most stores
eagerLink becomes visible in viewportHighFast servers, large inventories

Warning

eager mode can generate significant traffic — every category listing that enters the viewport will trigger prefetching all its product URLs. Monitor your origin server load after enabling it.


#Configuration

[optimization_speculation]
; Enable Speculation Rules injection
enabled = true

; Use navigation pattern learning (see below)
smart_speculation = true

; URL patterns prerendered when visiting the homepage
home_prerender = /catalog/category/view/*, /cms/*

; URL patterns prefetched when visiting a category page
category_prefetch = /catalog/product/view/*

; URL patterns prefetched when visiting a product page
product_prefetch = /checkout/cart, /checkout

; conservative | moderate | eager
eagerness = moderate

#Pattern syntax

Patterns use glob syntax:

  • * matches any characters within a path segment.
  • ** is not supported — use a more specific prefix.
  • Multiple patterns: comma-separated.

Examples:

; Prefetch all product pages (standard Magento URL format)
category_prefetch = /catalog/product/view/*

; Prefetch Hyvä-style clean URLs
category_prefetch = /product-name.html

; Prefetch multiple pattern types
product_prefetch  = /checkout/cart, /checkout/onepage/, /wishlist/

#Smart speculation (navigation learning)

When smart_speculation = true, Accelerate Guru observes which URLs visitors navigate to from each page type and refines the speculation targets based on real traffic data. Pages that are frequently visited next get prerendered; pages that are rarely visited are excluded to save bandwidth.

This means the speculation rules automatically improve over time as the system learns your store's navigation patterns — no manual tuning needed.


#Pages that are automatically excluded

To prevent session corruption, speculation is never applied to:

  • /checkout/* — active checkout must not be prerendered with stale cart state.
  • /customer/account/* — account pages contain user-specific data.
  • /admin/* — admin pages must not be preloaded.
  • /rest/* and /graphql — API endpoints.
  • /paypal/* and other payment gateway paths.

These exclusions are built in and cannot be accidentally overridden.


#Measuring the impact

#In Chrome DevTools

  1. Open DevTools → Application tab → Background ServicesSpeculation Rules.
  2. You can see which URLs were speculated, their status (pending, prefetched, prerendered), and whether a prerendered page was actually used.

#In Lighthouse

Run Lighthouse in Navigation mode. In the Performance section, look for:

  • LCP (Largest Contentful Paint) — on a prerendered page, this can drop to near-zero because the page is fully rendered before the navigation.
  • FCP (First Contentful Paint) — similarly near-zero.
  • TBT (Total Blocking Time) — not affected by speculation (TBT is about main-thread work during load, not navigation timing).

#In Chrome User Experience Report (CrUX)

Navigation to prerendered pages registers as instant navigations in the CrUX dataset. Over time, as Chrome captures more data, your store's "good LCP" rate in Core Web Vitals should increase, which can positively affect Google Search ranking.


#Third-party analytics compatibility

Most analytics tools (Google Analytics 4, Adobe Analytics, Segment) handle prerendered pages correctly because they use the Page Visibility API to detect when a prerendered page is actually activated. You should test your specific analytics implementation after enabling eager mode.


#Disabling speculation on specific pages

If certain pages should never be speculation targets (e.g. pages that create side effects on load), add them to a custom exclusion list. Contact support for guidance on path-specific exclusions.