Previewing an API Test
API tests run custom JavaScript on your store, so thorough QA is essential before launching. A script error can break page functionality, interfere with other apps, or cause visual glitches. This guide walks you through previewing and testing your API test to catch issues before they reach visitors.
Enter preview mode
Open your test in Shoplift and click Preview. This opens your store in a new browser tab with Shoplift's preview mode enabled.
When preview mode is active:
A preview control bar appears at the top of the page showing which variant you're viewing.
You can switch between the control and variant using the control bar.
No visitor record is created and no analytics events are sent. Your preview activity doesn't affect test data.
Audience rules and traffic allocation are bypassed, so you can see any variant regardless of targeting settings.

Check your variant
Switch to the variant using the preview control bar. Verify that your JavaScript changes appear as expected. Then switch back to the control to confirm the original store experience is unaffected.
For an automatic API test, the variant code runs automatically when you switch to the variant view. You should see your changes immediately.
For a manual API test, switching to the variant in preview mode simulates the trigger — you don't need to manually fire the isHypothesisActive() call during preview. Shoplift handles this so you can see the variant experience directly.
If your manual API test uses a behavior-based trigger (like scroll depth or time on page), also test the trigger logic separately. Preview mode lets you see the variant experience, but you should verify that your trigger code fires at the right moment by testing it outside of preview mode using the URL parameter method described below.
QA checklist
Work through each of these checks before launching:
Visual and functional checks
Script-specific checks
For manual API tests only
Testing with URL parameters
For more advanced QA, you can force a specific variant without using Shoplift's preview bar:
Force a specific variant:
This assigns you to the specified variant, simulating a real visitor experience. This is useful for testing manual API test triggers end-to-end.
Last updated
Was this helpful?