Using Pleras with Shoplift
Pleras generates A/B test code that runs on top of your existing site. This guide covers how that code is deployed when you use Shoplift as your testing platform, what your options are, and the trade-offs of each. For the underlying code structure and how experiments interact with your site, see the Developer Guide.
Shoplift website: shoplift.ai
Shoplift docs: docs.shoplift.ai
About Shoplift
Shoplift is a Shopify-native A/B testing platform. Unlike generic client-side testing tools, variants in Shoplift are real Shopify templates, themes, or theme code, served by Shopify itself rather than injected by a script after the page loads.
Test types Shoplift supports
- Template tests. Duplicate a Shopify template, edit the duplicate in the Theme Editor, and Shopify serves the assigned template per visitor.
- Theme tests. The same idea at the whole-theme level.
- URL redirect tests. Compare two URLs.
- Price tests. Test different price points.
- JavaScript API tests. Custom code in the theme, gated on a Shoplift hypothesis ID.
Technical details
- Bucketing is 50/50 and sticky per visitor on the same device and browser.
- Shoplift does not currently support A/B/n testing.
- Purchase tracking uses the Shopify Web Pixel API.
- The stats engine is Bayesian.
Compatibility with Pleras
Pleras supports all of Shoplift's test types.
| Shoplift test type | Pleras compatibility |
|---|---|
| Template tests | Full. See Option 1. |
| Theme tests | Full. See Option 1. |
| URL redirect tests | Full. See Option 1. |
| JavaScript API tests | Full. See Option 2 or Option 3. |
| Price tests | Partial. See Price testing. |
Choosing an option
The right choice depends on who runs your tests internally and how you prefer to deploy code:
- Teams already comfortable with Shoplift's no-code workflow that want changes scoped to a specific page or theme: Option 1 (template, theme, or URL redirect test).
- Engineering-led teams that want variant code in the theme codebase: Option 1 or Option 2 (JavaScript API test, theme deployment).
- Marketing or CRO-led teams that want to deploy without engineering tickets: Option 3 (JavaScript API test, GTM deployment).
Each test created in Shoplift requires the client to set it up in the dashboard first to generate the hypothesis ID (for JavaScript API tests) or create the variant template, theme, or URL (for the other types). Shoplift does not have a management API, so this step can't be automated.
Option 1: Template test, theme test, or URL redirect test
Use this option when the test fits naturally into Shopify's existing structure: a specific page type, an entire theme, or a separate URL. The variant lives in Shopify as a real template, theme, or page, and Pleras supplies the JavaScript that runs on it.
Workflow
- Create the test in the Shoplift dashboard (template, theme, or URL redirect).
- Set up the variant: duplicate the template or theme, or build the variant URL.
- Add a
<script>tag containing the Pleras-generated JavaScript to the variant. This can be done either:- In the Shopify Theme Editor, via a Custom Liquid block or by editing a section file.
- Through the client's own theme deployment process (Shopify CLI, Git-based theme management).
- Launch the test.
How bucketing works
For template and theme tests, Shoplift only serves the variant template or theme to assigned visitors. The script runs only on the variant by definition, so no gating logic is required in the variant code.
For URL redirect tests, Shoplift requires both URLs to be live and accessible. Visitors entering via the original URL are bucketed and redirected to the variant URL. Visitors who reach the variant URL directly (search, internal links, sitemap, bookmarks) load the variant page outside the test, and any Pleras code on that page will run for them. This is expected behaviour for URL redirect tests in Shoplift.
Trade-off
Any change to the variant requires a deploy to the theme, whether through the Shopify Theme Editor or via the client's own theme deployment process.
Option 2: JavaScript API test, deployed via Shopify theme
Use this option when the test logic needs to run across multiple page types, or when keeping the variant in code is preferable to duplicating a Shopify asset.
Shoplift exposes a client-side method, window.shoplift.isHypothesisActive(hypothesisId), that returns whether the current visitor is in the variant. Full reference: docs.shoplift.ai/test/javascript-api.
Workflow
- Create a JavaScript API test in the Shoplift dashboard.
- Copy the hypothesis ID Shoplift generates.
- Enter the hypothesis ID on the experiment page in Pleras.
- Pleras generates the variant code, wrapped in an
isHypothesisActivecheck. - Add the code to a theme file (
theme.liquid, a snippet, or a Custom Liquid block). This works regardless of whether the page is rendered from a Liquid or JSON template.
Code pattern
function waitForShoplift(callback, maxAttempts = 30) {
let attempts = 0;
function check() {
if (window.shoplift) {
callback(window.shoplift);
} else if (attempts < maxAttempts) {
attempts++;
setTimeout(check, 50);
} else {
console.warn('Shoplift did not load within the expected time.');
}
}
check();
}
waitForShoplift(async (shoplift) => {
if (await shoplift.isHypothesisActive('hyp_xxx')) {
// Pleras-generated variant code
}
});
The variant code waits for window.shoplift to be available before running. Shoplift injects its script into the <head> and it's normally ready almost immediately, so the check usually passes on the first attempt. The polling provides defensive cover for cases where the script takes longer than expected to initialise.
Option 3: JavaScript API test, deployed via Google Tag Manager
This option uses the same Shoplift JavaScript API test type as Option 2. The variant code is deployed as a Custom HTML tag in Google Tag Manager rather than placed in the theme.
Workflow
- Create a JavaScript API test in the Shoplift dashboard.
- Copy the hypothesis ID.
- Enter the hypothesis ID on the experiment page in Pleras.
- Pleras generates the variant code, wrapped in an
isHypothesisActivecheck. - In GTM, create a Custom HTML tag containing the code, with a trigger set to DOM Ready (or Window Loaded if the test modifies content that loads asynchronously).
- Publish the GTM container.
Considerations
- Marketing or CRO can deploy directly without engineering tickets.
- Shoplift's documentation assumes theme placement, so their support may be less familiar with GTM-based setups.
Price testing
Pleras supports tests that change how pricing is presented to the visitor. Tests that change the actual transaction price are configured directly in Shoplift using the price test feature, not through Pleras.
Testing how pricing is presented (supported)
Pleras supports presentation and packaging tests around pricing, not tests that change the price itself. Examples of supported tests:
- Wording of the savings label, e.g. "Save £15" vs "25% off".
- Showing or hiding the compare-at price set in Shopify.
- Position, layout, or styling of price elements on a product display page, collection page, cart drawer, or cart page.
- Adding or removing supporting context around the price (delivery thresholds, finance options, value framing).
Deploy these tests via Option 1, Option 2, or Option 3.
Testing different transaction prices (not supported)
Tests that change the price the customer is actually charged (e.g. testing £49 vs £44) require Shoplift's price test feature, which uses Shopify Cart Transform Functions to apply the variant price across the product page, cart, and checkout. JavaScript cannot change the transaction price, so Pleras cannot generate code for this kind of test.
Pleras can recommend transaction price tests as part of its experiment ideas, but the test itself is configured directly in Shoplift.
Constraints
- Checkout pages can't be modified by JavaScript. This is a Shopify platform restriction that applies to every testing tool, not just Shoplift. Shopify locks down checkout to protect the transaction flow. Tests that depend on changing the checkout itself are only possible via Shoplift's price test feature (which uses Shopify Cart Transform Functions on the backend) or via Shopify Checkout Extensibility, which is a separate setup.
- Every test requires the client to create it in Shoplift first. There is no Shoplift management API for Pleras to automate this.
- Pleras code cannot be pasted directly into the Shoplift dashboard. It always lives in the theme, in a tag manager, or inside a duplicated template, theme, or page.