# QA and preview

Check every variation on your real site before anyone else sees it, share it with colleagues, and see exactly what TryFast decided on a page.

## Preview links

A preview link opens your page with one variation forced on, for whoever opens it, on any device:

```text
https://acme-shop.de/pricing?tf_preview=tfpv1...
```

- Get them in the app (**Preview and QA**: one link per variation, plus "Random, like a real visitor"), from the API (`POST /api/v1/experiments/{id}/preview-links`) or from your agent (`get_preview_link`; `create_experiment` returns them too).
- The preview stays on for the whole browser tab, also on other pages of your site, and shows a small badge with the experiment, the variation and **Exit preview**.
- Preview ignores the audience and the traffic share; the page rules and the trigger still apply. So open the link on a page the experiment targets.
- Preview visits are marked as test traffic: they appear in the live events list but never in results.
- Links work for drafts, scheduled, running, paused, stopped and shipped experiments, and are valid 7 days by default (1 hour to 30 days with `ttl_hours`). In workspaces without an account they are valid at most 24 hours, and each link loads at most 200 times a day (1,000 times per project).
- **Revoke all links** (`POST /api/v1/experiments/{id}/preview-links/reset`, or `reset_preview_links`) makes every preview and editor link of the experiment stop working at once.
- A link only works on a page that runs the same project's snippet.

When the link has expired, the badge says so and the page runs normally. In a split URL test the badge appears on the destination page too.

The inline snippet removes the preview token from the address bar before your analytics tags run, so the token does not end up in your analytics.

## A QA checklist

1. Open each variation's preview link on a phone and a desktop. Check the change, and the page around it.
2. Click through to a second page and back: in single-page apps the change should disappear on pages outside the experiment and come back.
3. Trigger your primary goal in the preview (click the button, place a test order) and check the **Live events** page (or `get_events`): preview events show with `qa=true`.
4. Check flicker: reload a few times. If the original flashes, move the snippet higher in the `<head>` ([Install](../install.md#anti-flicker)).
5. Check consent: in a private window, without accepting your cookie banner, the page must show the control and send nothing (with the default consent mode).
6. Read the launch checklist in the app, or `GET /api/v1/experiments/{id}/preflight`.

## Debugging

Add `?tf_debug=1` to any page of your site. The browser console then shows every decision for that tab:

- the consent state and the visitor id (once stored),
- each experiment: every page rule and audience condition with the actual value and the result, the trigger state, the assignment and where it came from (`hash` for a new assignment, `sticky` for a stored one, `preview`, `shipped`),
- the changes applied and selectors that matched nothing,
- goals fired and event batches sent.

`tryfast.state()` returns the same information as an object, which is handy in automated tests. `?tf_debug=0` turns logging off again. `?tf_disable=1` shows the page without TryFast for one page view (`?tf_disable=session` for the tab), to compare.

## Exclude your own browser

Open `https://your-site.example/?tf_optout=1` once in every browser you use for work: that browser sees your original pages and is not counted. `?tf_optout=0` undoes it. Previews still work in an excluded browser, without counting.

## Live events

**Live events** in the app (and `get_events` for agents) show the most recent page views, exposures and conversions of the last 24 hours, newest first, including preview traffic, and the event keys seen. Use it to confirm that a goal fires before you launch. Events show random visitor ids, never IP addresses.
