LiveVariant

v0.1.5
io.github.livevariant/livevariant Checked 5 hours ago Published 3 months ago

Build, inspect and read adaptive A/B tests.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

build_test Build a test

Creates a LiveVariant test and returns every URL needed to run it, plus a freshly generated stats secret. Pass `variants` to test one element, or `slots` to test several at once (hero image AND call-to-action, say). With slots the test optimizes the COMBINATION: one model learns how the elements interact, which two separate tests structurally cannot see. There is no algorithm to pick either way; every test runs the same joint model, sized from its shape. By default, nothing is registered anywhere: the config IS the test, encoded into the URLs, and the test's identity is a hash of it. Pass `p…

ParameterTypeDescription
contextarrayDimensions to learn a separate winner for.
namestringA label for your own reference, and the one field worth spending a merge tag on in a recurring ESP template: it is part of the test's identity, so n={{campaign_name}} mints a separate, separately read…
publishableKeystringRegisters the new test to the organization identified by a publishable key the user provides for an organization they administer. Result access stays tied to this test's stats secret. Only works on ac…
redirectUrlstringWhere clicks land when a variant does not say.
regionstringWhere the test's state lives. A placement hint (wnam, enam, sam, weur, eeur, apac, oc, afr, me) or "eu" for the EU jurisdiction (state guaranteed created and kept inside the EU). Defaults to the creat…
slotRedirectsobjectWhere clicks on ONE element land, when elements point at different pages (a hero leading to the campaign landing page, a CTA below it to pricing). Keyed like `slots`. Falls back to `redirectUrl`; a va…
slotsobjectMulti-element test: variants per element, keyed by a short name like "hero" or "cta". The test serves and learns combinations.
variantParamstringStamp the served combination into this parameter on redirect, e.g. "utm_content", so the test shows up in the customer's own analytics.
variantsarraySingle-element test: two or more variants. The first is the control.

inspect_test Inspect a test

Decodes a test and describes it: slots, variants, context, and whether it can be served by redirect. Also lints it for the mistakes that only show up once a campaign is out, such as an email test whose context comes from geo (which a mail proxy answers about itself). Use this before sending anything, and to answer 'what is this link?'.

ParameterTypeDescription
configstringAlias for `test`: the same value under the name build_test returns it as (`config`). Pass one or the other.
teststringThe test: an encoded config, or any LiveVariant URL containing one (serve, click, pixel, manage), or a query-parameter serve URL. Paste whatever you have.

generate_priors Add warm-start priors

Takes YOUR estimate of how each variant will perform and converts it into the prior the model starts from, so a test does not spend its first visitors rediscovering what you already suspect. You supply the guess; this does the arithmetic and the capping. That capping is the point: a prior is expressed as pseudo-observations, and it is deliberately held weak enough that real data overrides it quickly. The response says exactly how many real visitors per variant it takes to wash your guess out, so you can judge whether you have been too confident. Being wrong here costs a little early traffic,…

ParameterTypeDescription
beliefs *array
confidenceHow much your guess is worth in observations. low=5, medium=15, high=30, or give a number directly. Higher means the test trusts you for longer before the data takes over.
configstringAlias for `test`: the same value under the name build_test returns it as (`config`). Pass one or the other.
teststringThe test: an encoded config, or any LiveVariant URL containing one (serve, click, pixel, manage), or a query-parameter serve URL. Paste whatever you have.
whenobjectContext this belief is limited to, as dimension key to value (e.g. {"color": "blauw"}). The keys must be dimensions the test declares. Omit it for a belief about every visitor.

get_stats Read a test's results

Fetches a test's results and works out what they mean. Alongside the raw counts it returns the probability that each combination is genuinely best and the expected cost of stopping now and keeping the leader. Use those rather than comparing conversion rates by eye: a variant ahead 2/10 to 1/10 looks twice as good and is very close to a coin flip, and that mistake is the single most common way an A/B test gets called wrong. Multi-slot tests also report per-slot marginals: how each variant did across every combination it appeared in. Needs the stats secret. If you have the manage URL, its #fr…

ParameterTypeDescription
configstringAlias for `test`: the same value under the name build_test returns it as (`config`). Pass one or the other.
statsSecretstringOmit when passing a manage URL that carries it in the fragment.
teststringThe test: an encoded config, or any LiveVariant URL containing one (serve, click, pixel, manage), or a query-parameter serve URL. Paste whatever you have.

upload_image Upload an image

Uploads an image to the deployment's asset store and returns its URL, for use as a variant's `image` (email tests) or `url`. The returned URL is deliberately not fetchable on its own: assets are only served with a short-lived signature that the serve endpoints mint per request, so uploading here does not create free static hosting. Use `previewUrl` (valid for an hour) to check what was stored. Storage is content-addressed: the id is the sha256 of the bytes, so uploading the same image twice is harmless and returns the same URL. Raster images only; SVG is refused because it can carry scripts.…

ParameterTypeDescription
contentType *stringThe image's actual type; the server stores and serves it as this.
data *stringThe image bytes, base64-encoded (plain base64, not a data: URL).

variant_brief Brief for writing variants

Returns the constraints to write or generate test variants against, for email or web, plus the rules that decide whether a test can be read at all once it runs. The one that matters most: one idea per slot. To vary two elements, give the test two slots and let it learn the combination, rather than bundling both changes into one variant and never learning which half worked. Ask for this before drafting variants, then produce them yourself against what it returns.

ParameterTypeDescription
channel *string
format *stringWhat each variant will be.
goal *stringWhat the test should improve, e.g. 'more demo bookings'.
audiencestringWho sees it, if that shapes the copy.
countinteger