Start a Project

Speed Up Your Store with Speculation Rules in Bagisto

Bagisto continues to enhance performance and user experience with advanced front-end optimization features — and one of the most exciting among them is Speculation Rules.

This powerful feature allows you to improve page load speed by intelligently preloading or prerendering pages based on user interaction predictions. In this blog, we’ll walk you through the options available under Speculation Rules in Bagisto, and how each setting can benefit your store’s performance.

What Are Speculation Rules?

Speculation Rules allow the browser to take proactive steps to make the next page load faster — even before the user clicks anything. It uses machine learning or link prediction to preload (prefetch) or pre-render the next likely page based on user behavior.

There are two major strategies within speculation:

  1. Prefetching – Loads static resources (HTML, CSS, JS) in the background.

  2. Prerendering – Loads and renders the full page in the background.

Bagisto provides full control over both strategies in the admin panel, allowing you to fine-tune them to your needs.

Features of Speculation Rules in Bagisto

Here’s a breakdown of each available setting and what it does:

This is the master switch to turn on or off the Speculation Rules feature entirely. When enabled, the browser can start to predict and load future pages in the background.

Use case: You want to improve performance on high-traffic pages (like homepage, category pages, or product listings) where users frequently move from one page to another.

When this option is turned on, Bagisto allows the browser to prerender pages — meaning the entire page is loaded and rendered in a hidden tab before the user clicks on it. This is perfect for pages where users are highly likely to go next, such as product detail pages from a listing.

Use Case: On a product listing page (PLP), if a user hovers over a product card or focuses a product link, the detail page (PDP) starts rendering in the background.

Sometimes, there are URLs that you don’t want to prerender — maybe they have dynamic data or performance-heavy elements. With this setting, you can specify URLs that should be skipped during the prerender process.

Use case:  These pages are user-specific or dynamic and shouldn’t be prerendered as that could lead to outdated or incorrect data being shown.

This allows you to filter out certain query parameters so that URLs with tracking or session-specific parameters don’t get prerendered unnecessarily.

Use case: These parameters don’t impact page content and may lead to duplicate caching. Ignoring them improves efficiency.

Just like prerendering, prefetching comes with an eagerness level:

Choose wisely based on how much resource usage your server can handle.

When enabled, this setting allows Bagisto to use the browser’s prefetching mechanism to load future pages’ resources in the background — before the user even clicks. Prefetching downloads important page assets like HTML, CSS, JS, and fonts for a linked page. It does not render or execute the page, but stores the resources so that when a user navigates to that link, the page loads significantly faster.

Use case: This helps speed up future navigation without consuming too many resources.

Here, you can define URLs or patterns that should NOT be prerendered. This prevents resource waste and potential issues with dynamic pages.

Use case: These pages are user-specific or dynamic and shouldn’t be prerendered as that could lead to outdated or incorrect data being shown.

However, some URLs may include query parameters (like tracking info or session tokens) that don’t change the page content but may result in duplicate or unnecessary prerendering.

The “Ignore Prefetch URL Parameters” setting ensures that such parameters are excluded when determining the uniqueness of a URL. This allows the system to recognize that different URL variations — despite having different query strings — point to the same underlying content, and therefore, do not need to be prefetched multiple times.

Just like prerendering, prefetching comes with an eagerness level:

 

Thanks for reading this blog. Please comment below if you have any question. Also you can hire laravel developers for your custom laravel projects. kindly explore our extensions.

Exit mobile version