# Performance Docs

### Performance topics

* [Pagespeed](https://abgenius.gitbook.io/abgenius-docs/documentation/getting-started/performance-docs/pagespeed)
* [Shopify caching](https://abgenius.gitbook.io/abgenius-docs/documentation/getting-started/performance-docs/shopify-caching)
* [CDNs and edge delivery](https://abgenius.gitbook.io/abgenius-docs/documentation/getting-started/performance-docs/cdns-and-edge-delivery)

{% hint style="info" %}
Need help with performance or questions about how AB Genius loads on your store? Email **<info@abgenius.io>**.
{% endhint %}

***

## Pagespeed

### AB Genius is built for speed.

One of the most common concerns merchants have when installing any Shopify app is whether it will slow down their store. Slow pages kill conversions — we know this better than anyone. That's why AB Genius was engineered from the ground up to have zero measurable impact on your store's pagespeed.

### How AB Genius loads on your store

AB Genius uses a Shopify Theme App Extension to deliver experiments to your storefront. This is important because it means there are no externally injected scripts, no third-party tags, and no heavy JavaScript frameworks loading on your pages.

The storefront script (`ab-live.js`) is written in vanilla JavaScript — no libraries, no dependencies. It loads asynchronously, which means it does not block your page from rendering. Your page content, images, and layout all load independently of AB Genius.

### What happens for visitors NOT in an experiment?

Nothing. If a visitor is not part of a running experiment, AB Genius does not execute any logic, make any API calls, or modify any page elements. The script detects that there is no active experiment for that visitor and exits immediately.

This means the vast majority of your traffic — visitors on pages without active tests — experiences zero additional load.

### What happens for visitors IN an experiment?

For visitors assigned to an experiment, AB Genius makes a single lightweight API call to retrieve their group assignment and any associated changes (prices, content modifications, or redirect instructions). This call is optimised to return all necessary data in one round trip.

For price tests specifically, AB Genius uses anti-flicker technology. Price elements are hidden with CSS the moment the script loads — before any theme JavaScript runs. This prevents the original price from being visible even for a fraction of a second. Once the correct A/B test price has been applied, the elements are revealed.

The result is a smooth, instant experience for the visitor. No flashing. No layout shift. No visible swap.

### How to verify AB Genius isn't affecting your pagespeed

You can run your store through Google PageSpeed Insights or GTmetrix before and after enabling AB Genius. In our testing, the difference is negligible — typically within the margin of measurement error.

If you want to be thorough, test with experiments both active and inactive. You should see no meaningful change in your Core Web Vitals scores (LCP, CLS, INP).

### Tips for maintaining fast page speeds

While AB Genius won't slow your store down, your overall store performance matters for conversions. A few things to keep in mind:

* Compress your images before uploading them to Shopify. Use tools like TinyPNG or convert to WebP format.
* Limit the number of apps injecting scripts on your storefront. Every app adds weight.
* Enable lazy loading for images below the fold. Most modern Shopify themes support this natively.
* Minimise custom fonts and heavy animations, especially on mobile.

A fast store converts better. AB Genius helps you test what works — but speed is the foundation everything else sits on.

***

## Shopify Caching

### How Shopify caching works — and how AB Genius handles it.

Shopify uses aggressive server-side caching to deliver fast page loads. This is great for performance, but it can create confusion when you're running A/B experiments. Here's how it works and why AB Genius is built to handle it properly.

### What Shopify caches

Shopify caches your storefront pages at the server level. When a visitor requests a product page, Shopify often serves a cached version of that page rather than rendering it from scratch every time. This significantly reduces load times.

However, this means that the HTML delivered to every visitor is typically identical — it's the same cached page regardless of who's viewing it.

### Why this matters for A/B testing

Some A/B testing tools rely on server-side rendering to deliver different experiences to different visitors. This approach conflicts with Shopify's caching layer because Shopify serves the same cached HTML to everyone.

Tools that try to modify the page before it's sent to the browser often fail on Shopify, or they require workarounds that bypass caching entirely — which slows down your store.

### How AB Genius solves this

AB Genius doesn't fight Shopify's caching. It works with it.

AB Genius delivers experiments client-side through a Shopify Theme App Extension. The cached page loads as normal, at full speed. Then the AB Genius script runs and applies the correct experiment variation for that specific visitor.

For price tests, this means the cached page loads with the original prices, and AB Genius instantly swaps them to the test prices before the visitor sees anything (using anti-flicker technology). For content tests, text and element modifications are applied in the same way.

The visitor's group assignment is stored in a browser cookie (`ab_data`) that caches the assignment for one hour. This means on subsequent page loads within that window, AB Genius doesn't even need to make an API call — it reads the cached assignment and applies the variation immediately.

### What about Shopify's CDN cache?

Shopify's CDN caches static assets like images, CSS, and JavaScript files. AB Genius scripts are loaded through the Theme App Extension system, which means they benefit from Shopify's CDN caching automatically.

The script itself is cached and served from Shopify's edge network, just like your theme files. This keeps load times fast and consistent across geographies.

### Cart and checkout caching

Shopify handles cart and checkout pages differently from storefront pages. AB Genius accounts for this by using Shopify's Cart Transform Function — a server-side function that runs inside Shopify's own checkout infrastructure.

When a visitor in a price test adds a product to cart, the test price is embedded in the cart attributes. At checkout, the Cart Transform Function reads this data and applies the correct price. This happens server-side within Shopify's checkout — not through cached pages or client-side scripts.

This means price tests are checkout-safe regardless of how Shopify caches your cart or checkout pages.

### Common questions

<details>

<summary>Will clearing my Shopify cache affect running experiments?</summary>

No. AB Genius experiment data is stored in our database and delivered via API calls. Clearing your Shopify cache does not affect visitor assignments, experiment data, or results.

</details>

<details>

<summary>Why do I see the original price when I preview my own store?</summary>

AB Genius excludes admin sessions from experiments. If you're logged into Shopify and viewing your store, you won't be assigned to any experiment group. Always test in an incognito or private browser window to see the experiment as a real visitor would.

</details>

<details>

<summary>Does Shopify's page caching cause visitors to see the wrong variation?</summary>

No. Visitor assignment is handled per-browser via cookies, not at the page cache level. Each visitor receives their own assignment regardless of which cached version of the page they receive.

</details>

***

## CDNs and Edge Delivery

### How AB Genius works with Shopify's global CDN infrastructure.

Shopify operates one of the largest ecommerce CDN (Content Delivery Network) infrastructures in the world. Every Shopify store benefits from edge delivery — your pages are served from whichever data centre is closest to your visitor, anywhere in the world.

Here's how AB Genius is designed to work seamlessly within this architecture.

### What edge delivery means for your store

When a visitor in London loads your Shopify store, they're served content from a nearby edge server rather than a central origin server that might be on the other side of the world. This dramatically reduces latency and page load time.

Shopify's CDN caches and distributes your theme assets (HTML, CSS, JavaScript, images) across a global network of edge servers. This is why Shopify stores generally load fast regardless of where your visitors are located.

### How AB Genius integrates with edge delivery

AB Genius is delivered to your storefront through Shopify's Theme App Extension system. This is important because Theme App Extensions are treated as native theme assets by Shopify — meaning they are distributed, cached, and served through the same CDN infrastructure as your theme.

When a visitor loads your store, the AB Genius script (`ab-live.js`) is served from the nearest Shopify edge server, just like the rest of your theme files. There is no separate CDN, no external script domain, and no additional DNS lookup required.

This means AB Genius loads with the same speed and reliability as your Shopify theme itself.

### API calls and edge performance

When a visitor needs to be assigned to an experiment, AB Genius makes a single API call to retrieve the assignment and any relevant experiment data (prices, content changes, or redirect URLs). This call is lightweight and optimised for speed.

To minimise the number of API calls, AB Genius caches the visitor's assignment locally in a browser cookie (`ab_data`) for one hour. During that window, repeat page loads use the cached assignment with no API call at all. The visitor's identity cookie (`ab_vid`) persists for one year, ensuring returning visitors are recognised and receive consistent experiences.

### Checkout at the edge — Cart Transform Function

For price tests, AB Genius uses Shopify's Cart Transform Function to apply test prices at checkout. This function runs inside Shopify's own server-side infrastructure — it's not a client-side script, and it's not an external API call.

The Cart Transform Function executes as part of Shopify's native checkout pipeline. This means it benefits from the same edge-optimised infrastructure that powers Shopify's checkout, with no additional latency for your visitors.

The test price payload is transmitted via cart attributes and secured with an HMAC signature, ensuring the data cannot be tampered with by the visitor.

### Event tracking and the Web Pixel

AB Genius tracks experiment events (product views, add-to-cart, checkout, purchases) using Shopify's Web Pixel extension. The Web Pixel is Shopify's official mechanism for event tracking — it runs in a sandboxed environment within the browser and does not affect page rendering or load speed.

Events are captured and transmitted asynchronously. They do not block any page interactions or create visible delays for your visitors.

### Multi-region stores and geo-targeting

Because AB Genius works on top of Shopify's global CDN, your experiments run consistently regardless of where your visitors are located. A visitor in Tokyo receives the same fast, flicker-free experience as a visitor in New York.

If you're running experiments with country-based targeting, AB Genius detects the visitor's location using a combination of browser timezone mapping and Cloudflare's geo-IP headers (which are part of Shopify's CDN infrastructure). This detection happens instantly with no additional network requests.

### The bottom line

AB Genius doesn't add a separate infrastructure layer on top of your store. It runs natively within Shopify's CDN and edge delivery system, using official Shopify extension points at every level — Theme App Extension for the storefront, Cart Transform Function for checkout, and Web Pixel for event tracking.

Your visitors get the same fast, globally distributed experience they'd get without any testing app installed. The experiments just happen invisibly on top of that foundation.

***

Need help with performance or have questions about how AB Genius works on your store? Contact us at <info@abgenius.io>
