AnalyticFastDocs
Docs / Server recipes

A/B experiments and user flows

AnalyticFast uses existing pageviews and goals for user flows. No tracker update is needed. Open User flows on the dashboard, choose a page or goal, and see the next three steps. To conversion works backwards from a goal or payment within a session. Reverse diagrams read from right to left; top paths always read chronologically.

Record an exposure

Create a definition in Settings → Experiments with a unique key, conversion goal (or payment), and optional control variant. Definitions begin measuring at creation time and become immutable; use a new key for a new test. End a definition to freeze its window. Deleting a definition keeps the underlying exposure events, so the key can be rediscovered.

Copy the assignment helper from the experiment card. It randomly chooses between two variants, persists the assignment in localStorage, and falls back to page memory when storage is unavailable. Honor your consent policy before assigning or recording. Render the assigned variant first, then call this after the tracker has loaded:

window.analyticfast?.('goal', 'af_experiment', {
  experiment: 'pricing-page',
  variant: 'B'
});

Use keys containing 1–64 letters, digits, hyphens or underscores, and nonempty variant names up to 64 characters. af_experiment is a reserved system goal, excluded from customer goal lists, goal rollups, insights and funnel step selection. It cannot itself be a conversion target. No extra script or dependency is added to the tracker.

Keys seen in exposure events without a definition appear as discovered. These use payment as their provisional conversion target. Defining one starts a fresh window; it does not reinterpret old events.

Interpret the report

Each visitor is assigned to their first observed variant in the effective report window. Repeated exposures count once. If they see several variants, their first assignment wins and the conflict count is shown. Conversions must occur strictly after exposure, within the same site and window; they may happen in another session. Each visitor converts at most once. Payments require a positive payment event; refunds alone cannot convert a visitor.

Revenue per visitor includes net payment amounts after exposure, including negative refunds, in the site's reporting currency. Other currencies do not contribute to this metric. Goal conversions can generate revenue later in the window, so revenue is measured independently of the chosen goal. Unattributed payments without a visitor ID cannot count.

Uplift compares conversion rates with the configured control, or the alphabetically first observed variant if the control is absent. Zero control conversions give no relative uplift. A pooled two-proportion z-test supplies a two-sided p-value. The directional normal approximation is labelled “chance to beat control”; it is not a Bayesian posterior probability. At least 100 exposed visitors, 10 conversions and 10 non-conversions in both compared variants are required before showing evidence. A p-value below 0.05 is marked significant. Repeated peeking and multiple comparisons raise the false-positive rate; decide your stopping rule before starting a test.

Bounds and accuracy

API and MCP

Cookie-authenticated dashboard endpoints:

GET    /api/sites/:siteId/user-flows?period=30d&direction=forward&start=page:/pricing
GET    /api/sites/:siteId/experiments?period=30d
GET    /api/sites/:siteId/experiments/:key/results?period=30d
POST   /api/sites/:siteId/experiments
PATCH  /api/sites/:siteId/experiments/:key/end
DELETE /api/sites/:siteId/experiments/:key

Create JSON: {"key":"pricing-page","name":"Pricing headline","conversion_target":"payment","control_variant":"A"}. Creation, ending and deletion require an admin or owner. Analytics reads require dashboard entitlement. All definitions and events remain scoped to one accessible site.

MCP tools user_flows and experiments require an analytics-read token and respect its workspace and optional site binding. Pass site_id, a date range, optional session filters, and either start/direction for flows or key for experiment results. Omit key to list definitions and discoveries. MCP money is in major currency units; dashboard API money is in minor units.