Install the tag
script_tag into the <head> of every page you want to test. The property is verified the
first time the tag loads from the registered domain; GET /v1/optimize/properties shows verified_at.
Endpoints
All endpoints take theoptimize:read scope for reads and optimize:write for changes.
Create and start a test
A test is a page, a goal, and one or more variants. Each variant is a list of DOM operations the tag applies for the visitors bucketed into it:setText, setAttribute, addClass,
removeClass, setStyle, hide, and replaceHref. Nothing in the list can introduce script.
form_submit, tel_click, cta_click, selector_click (each takes a selector),
and url_visit (takes url_match_type and url_pattern). traffic_split (0.05 to 1) is the
share of visitors enrolled; the rest see the page untouched.
Record a conversion
The tag counts goals it can see on the page. For outcomes that happen elsewhere, send them in. Include the tag’svisitor_id (the rd_sid cookie, or window.rdSite.visitorId) so the
conversion is credited to the arm that visitor saw.
metadata.order_id makes the write idempotent: a repeat returns recorded: false. value is in
major units and defaults to USD; it shows up as revenue_cents per variant in results.
Read results
variants[] carries impressions, conversions, conversion_rate, lift, p_value,
probability_to_beat_control, and revenue_cents. decision.reason is one of winner,
collecting, no_difference, or inconclusive; decision.winner_variant_id is set only for
winner. daily[] is a per-variant, per-day series for charts.
Events
Subscribe with webhooks. Site events are delivered flat and carry the event name in the body:optimize.conversion.created carries conversion instead of test, in the same shape as
GET /v1/optimize/conversions.