# Preview Mode

Force a specific variant for QA and stakeholder review.

Force a specific variant on a live test so you can QA each experience or share it with stakeholders — even visitors who wouldn't normally qualify will see exactly what you choose.

Preview mode is what you use to verify a test before launch and to share a variant link with reviewers. It overrides the SDK's normal assignment and targeting, so you can force any variant on any page the test targets — even on a fresh incognito session. Crucially, conversions fired during preview are flagged and excluded from your reports, so QA clicks don't pollute the data.

The two ways to enter preview mode (URL parameters and DevTools console) do the same thing under the hood. Pick whichever fits the workflow: URLs are great for sending to designers and PMs; the console is faster when you already have DevTools open.

## Shareable URL

```bash
# Append these query parameters to any page on your site
https://your-site.com/page?optimo-preview=TEST_ID&optimo-variant=VARIANT_NAME

# TEST_ID       - found in the URL of the test's detail page in Otter
# VARIANT_NAME  - the variant's name (e.g. "Variant B") or its numeric ID
```

## DevTools Console

```js
// Open Chrome DevTools (F12 or ⌘+Opt+I), go to the Console tab, then run:
sessionStorage.setItem('optimo_preview_id', 'TEST_ID')
sessionStorage.setItem('optimo_preview_variant', 'VARIANT_NAME')
location.reload()
```

## Clear Preview

```js
// Stop previewing and return to your normally-assigned variant:
sessionStorage.removeItem('optimo_preview_id')
sessionStorage.removeItem('optimo_preview_variant')
location.reload()

// Or simply close the browser tab — preview mode only lasts for the session.
```

## Good to know

- Preview mode bypasses targeting rules and triggers, so the chosen variant renders on any page in the test, regardless of visitor eligibility.
- Once set via URL, the preview is stored in `sessionStorage`, so you can navigate freely within the tab and keep seeing the same variant.
- Add `?optimo-debug` to enable verbose console logging — you'll see `[Optimo]` messages confirming which test and variant were applied.
- A page reload is required after changing the values — the SDK reads them on init, not continuously.

## Frequently asked questions

### What exactly does preview mode override?

Preview mode overrides variant assignment, targeting rules, and triggers. It does not override the URL-matching rules (the visitor still needs to be on a page the test targets) or the test's published status (paused tests don't render variants regardless of preview). It also doesn't fire conversions or affect your stats, so previewing your own site is safe.

### How long does a preview session last?

Until the browser tab closes, since the preview is stored in sessionStorage. You can navigate freely within the tab and keep seeing the same variant. To make the preview survive a tab close, you'd need to either reapply the URL parameters or manually copy the sessionStorage values into localStorage — we don't expose a 'persistent preview' on purpose, to avoid forgotten previews skewing future QA.

### Can I share a preview link with stakeholders?

Yes — that's the primary use case. Append ?optimo-preview=TEST_ID&optimo-variant=VARIANT_NAME to any page your test targets and send the link. Recipients see the chosen variant without needing accounts or special permissions. The preview is per-session per-browser, so each recipient's preview is independent.

### Does preview mode trigger conversions in my reports?

No. Conversions fired during preview mode are flagged and excluded from the results page. Your QA clicks, form submits, and purchases (if you're brave enough to test all the way through) don't pollute your stats.

### What's the difference between preview by URL and preview by DevTools console?

Functionally identical — both write the same two sessionStorage keys. URL is for shareable links and stakeholder review; DevTools is for engineers who already have the page open and don't want to bounce through a new URL. Pick whichever fits the workflow.

### How do I clear a preview?

Either close the tab (sessionStorage clears automatically), or run the two sessionStorage.removeItem calls from the DevTools console (or click 'Clear preview' on the test's QA panel in the dashboard — we wire that up automatically). Then reload the page — the SDK reads preview keys on init, not continuously.

### Can I preview a variant on a page the test doesn't target?

No. Preview mode bypasses targeting and triggers but still respects the test's URL match rules. If you need to preview a variant on a page outside the test, edit the test's URL match temporarily, preview, then revert. We're considering loosening this for explicit QA workflows.

---

Canonical page: https://www.otterab.com/docs/developer-reference/preview-mode
