> For the complete documentation index, see [llms.txt](https://docs.elevateab.com/elevate-helpcenter/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.elevateab.com/elevate-helpcenter/analyze/tracking/liquid-snippet.md).

# Liquid Snippet: How Elevate A/B Testing Loads

What the Elevate A/B Testing Liquid snippet does in your Shopify theme, how it is added automatically, and what to check if it goes missing.

Elevate A/B Testing adds a small Liquid snippet to your Shopify theme that powers all experiment delivery on your storefront. This page explains what it does, how it gets there, and what to know about it.

***

### What is the elevateab.liquid snippet?

The snippet is a file called `elevateab.liquid` that lives in your theme's `snippets/` folder. It's rendered at the top of your `theme.liquid` layout file, right after the `<head>` tag:

```liquid
<head>
  {% render 'elevateab' %}
  ...
</head>
```

This snippet is the bridge between your Shopify theme and Elevate A/B Testing's experiment engine. Without it, experiments can't run on your storefront.

***

### What Does It Do?

When a visitor loads a page on your store, the snippet does three things:

1. **Reads experiment configuration**: It pulls your active experiments, CSS selectors, and currency formatting from Shopify metafields and makes them available to the page.
2. **Sets up the testing environment**: It detects the current page template, active currency, theme ID, and whether the visitor is in a theme preview. This context is used to determine which experiments apply to the current page.
3. **Loads the Elevate A/B Testing script**: It injects the lightweight JavaScript that handles visitor assignment, page redirects (for split URL and page tests), and price/content changes. This is the script that actually delivers the experiment to the visitor.

The snippet only runs when the Elevate A/B Testing app is installed on the store. It includes a check (`content_for_header contains "elevateab.app"`) that prevents it from executing if the app isn't active. It also doesn't run in the Shopify theme editor, so it won't interfere with your theme customization.

***

### How is the snippet added to my Shopify theme?

The snippet is deployed **automatically**. No coding or manual setup is required on your part.

When you activate Elevate A/B Testing or launch an experiment, the system:

1. Creates the `snippets/elevateab.liquid` file in your active theme
2. Adds `{% render 'elevateab' %}` to your `layout/theme.liquid` file, right after the `<head>` tag

If your theme uses additional layout files, the snippet render tag is added to those as well.

***

### What happens if the snippet is removed or I switch themes?

Elevate A/B Testing monitors your active theme for the presence of the snippet. If it gets removed, for example because you switched themes, published a new theme, or manually deleted the file, Elevate A/B Testing automatically redeploys it when you next open the app or launch a new experiment.

You don't need to take any action if this happens. The system handles it.

***

### Performance Impact

The snippet is placed in the `<head>` section intentionally. This positioning ensures it executes as early as possible, which is critical for:

* **Preventing flicker**: Visitors don't see the original version flash before the test variation loads. See [Anti-Flicker](https://docs.elevateab.com/elevate-helpcenter/analyze/tracking/anti-flicker.md)
* **Accurate tracking**: Visitor assignment happens before the page renders, so every page view is correctly attributed

In performance testing, the snippet typically adds **1–2 points** of impact to page speed scores. This is a marginal tradeoff for accurate experiment delivery and flicker-free rendering.

***

### Important: Don't Remove the Snippet Manually

Removing the `elevateab.liquid` file or the `{% render 'elevateab' %}` line from your layout will prevent all experiments from running.

If you need to uninstall Elevate A/B Testing, use the standard Shopify app uninstallation process. Don't manually delete code files, as this can leave behind orphaned references or metafield data.

### What happens when I uninstall Elevate A/B Testing?

Your storefront goes back to normal: Shopify stops loading the app's scripts and price changes, and the snippet checks that the app is installed before it runs. Visitors see your original prices, pages, and products.

Uninstalling does not clean up after your experiments:

* **Duplicate products stay in your store.** Product experiments create duplicates as unlisted products, and Elevate A/B Testing cannot remove them once it is uninstalled. Delete them in Shopify if you no longer need them. See [Managing Duplicate Products](https://docs.elevateab.com/elevate-helpcenter/product-testing/managing-duplicate-products.md).
* **Older theme code may keep redirecting.** If your theme still has Elevate A/B Testing code from before the installed-app check was added, redirects can continue after you uninstall. If visitors are still redirected, contact <support@elevateab.com>.

If you reinstall later, every experiment that was running is paused and its duplicate products are moved to draft.

***

### Troubleshooting

#### Experiments aren't running on my store

Check that the snippet exists in your theme. Go to **Online Store → Themes → Edit Code** and look for `elevateab.liquid` in the `snippets/` folder. Also check that `layout/theme.liquid` contains `{% render 'elevateab' %}` near the top of the `<head>` section. If either is missing, open the Elevate A/B Testing app. It will automatically redeploy the snippet.

#### I switched themes and experiments stopped working

This is expected. When you publish a new theme, the snippet needs to be added to it. Open the Elevate A/B Testing app or launch/sync an experiment, and the snippet will be deployed to the new theme automatically.

#### The snippet is there but experiments still aren't working

The snippet depends on metafield data being up-to-date. Try syncing your experiment from the experiment settings dropdown. This refreshes the metafield data that the snippet reads.
