> For the complete documentation index, see [llms.txt](https://docs.turboload.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.turboload.ai/core-performance-features/storefront-optimizer.md).

# Storefront Optimizer

> **Runtime Mobile Acceleration:** Intelligently manage external third-party marketing scripts to eliminate main-thread lag and drastically improve Interaction to Next Paint (INP).

The **Storefront Optimizer** provides real-time, browser-level script management for your live Shopify storefront. It optimizes how external third-party apps load and execute in shoppers' browsers without modifying your theme files.

![TurboLoad Storefront Optimizer dashboard showing script deferral candidate controls, exclusion lists, and instant emergency kill-switch](https://3104101331-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4kkyKWXlRlIIrT0xXLUz%2Fuploads%2Fgit-blob-7e9f0d505b55c1bc55d26fb5cd1452431fb59afb%2F04_optimizer.png?alt=media)

***

## Direct Answer: How does the Storefront Optimizer improve Interaction to Next Paint (INP)?

The Storefront Optimizer automatically delays non-critical third-party tracking scripts, chat widgets, and review apps until after the primary hero content has rendered and the shopper has established their initial interaction. By preventing multiple heavy scripts from running simultaneously during initial load, the browser's main thread remains responsive, ensuring clicks, menu opens, and cart additions respond instantly.

***

## Why Script Deferral is Essential for INP

Most Shopify stores have between 10 and 30 third-party apps installed (e.g., Klaviyo, Judge.me, Yotpo, Hotjar, TikTok Pixel, Gorgias).

When a customer loads your store:

1. All these app scripts attempt to download and execute simultaneously.
2. The browser's main JavaScript thread becomes completely locked (known as **Total Blocking Time**).
3. If a customer tries to tap the navigation menu, search bar, or "Add to Cart" button while the thread is locked, the browser freezes, resulting in a poor **Interaction to Next Paint (INP)** score.

The Storefront Optimizer intercepts these non-critical scripts and defers their execution until the browser has finished painting the primary page and the shopper has established their initial interaction.

***

## Key Features & Controls

### 1. Global Optimizer Toggle

* **Status: Active / Paused:** Easily toggle the runtime optimizer on or off across your entire store with a single click in the TurboLoad admin (`/app/optimizer`).
* If paused, scripts load in their standard default browser behavior.

### 2. Script Exclusions Table

Certain scripts are mission-critical and should never be delayed (such as cookie consent banners or currency converters).

* The **Exclusions Table** allows you to add specific script domains or keywords (e.g., `consent-banner.js`, `currency-switcher`).
* Any script matching your exclusion rules will bypass deferral and execute immediately.

### 3. Smart Resource Hints

Automatically injects early browser hints:

* `dns-prefetch`: Resolves third-party DNS records in the background.
* `preconnect`: Initiates TLS handshakes early for high-priority domains like Google Fonts and Shopify CDN.

***

## How to Test: The Safe Bypass Query

Want to test your store with and without TurboLoad's optimizer running to verify functionality or compare speeds?

Simply append the **Bypass Query Parameter** to any storefront URL:

```
https://your-store.com/?__turbo_bypass=1
```

When this parameter is detected:

* The TurboLoad Optimizer embed completely deactivates itself for that specific browser session.
* You can compare network waterfall charts in Chrome DevTools to confirm the exact before-and-after performance improvements.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.turboload.ai/core-performance-features/storefront-optimizer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
