Skip to content

Experiments

An experiment shows some of a site’s visitors a changed version of its pages and the rest the pages as they are, and counts which converts better. Digize runs it at the edge, in front of the site: it puts each visitor in a variant before the site answers, serves that variant, and records it. The site doesn’t split traffic or count anything, and most tests need no change to its code. Experiments are part of Analytics, under Analytics › Experiments, and need full tracking.

Every variant of an experiment changes the same kind of thing:

Kind A variant is For
Content Parts of the page’s HTML swapped as it’s served, and CSS added to its <head> A headline, a button’s label, an image, a form, a block taken out, a colour
Page Another path of the same site served in the page’s place; the address the visitor sees stays the page’s A new layout of one page
Site Another of the workspace’s sites answering every request of a visitor in it, its scripts and images too A redesign

An experiment has the control (a, the page as it is) and up to three variants (b, c, d), each with a share of its visitors. It runs on up to 10 pages: paths such as / or /pricing, with * at the end for a page and every page under it (/blog/*). It can put only some of the site’s visitors in the test: the rest see the control and aren’t counted.

Each swap of a content variant takes a CSS selector, as Cloudflare’s HTMLRewriter reads them (no + or ~ between elements), and one of:

Swap What it does to each element the selector finds
text Sets its text
html Sets its inner HTML
replace Puts HTML in its place
attribute Sets one attribute, such as an image’s src or a link’s href
remove Takes it out

A variant changes words, markup, images and styles, never what runs on the page: a swap can’t add scripts, frames, event handlers or javascript: links, and its CSS can’t hold markup. A variant has up to 20 swaps of up to 4,000 characters each and 8,000 characters of CSS.

A page variant is a page the site already has at its own path, such as /pricing-b; Digize follows the site’s own redirect between /pricing-b and /pricing-b/. A site variant is a site of the workspace that has gone live, usually a copy of the one tested (POST /api/v1/sites/{site}/copy makes one, with its code, plain variables and build settings, though not its secrets, and with storage of its own); it answers on the tested site’s address as that site, so its forms and checkouts count for it.

A content test finds what it changes by its selector, so a selector that keeps working whatever else changes on the page makes a test that keeps working. Mark each part a test may change with data-digize-slot:

<h1 data-digize-slot="hero-title">Cold brew, delivered weekly</h1>
<a class="button" href="/shop" data-digize-slot="hero-cta">Shop the beans</a>

The selector is then [data-digize-slot="hero-title"]. Give each slot one element on a page, and a name that says what the part is. Swaps happen in the HTML Digize sends, so a slot belongs on markup the server sends, not inside a component the browser renders or hydrates, which would put the original back. GET /api/v1/analytics/experiments/elements reads a page as visitors get it and lists what a test can change on it (slots, headings, buttons and calls to action, forms and images), each with a selector that finds it alone, or none where it needs a slot first. The workspace’s agent adds slots with a coding run.

Draft Set up, changing nothing visitors see. Its variants can be previewed.
Running Visitors on its pages are put in a variant and counted, within a minute of starting.
Paused Everyone sees the control again, within a minute; visitors keep their variant for when it’s resumed.
Ended Over for good, with its winner if there was one, which can be served to everyone.

A draft changes freely. Once an experiment has run, its name, hypothesis and goal change, and while it’s paused its share of traffic, its weights, and new variants added after the ones it has (up to four in all). What an existing variant shows and the pages don’t change, and no variant can be taken away, or its results would mix two tests. A site has up to 5 experiments running and 10 that aren’t over. A site experiment runs on its own on its site, and two page experiments can’t run on the same page.

To see a variant before or while it runs, open a page of the experiment with ?_dz_preview=<id>.<key> (the experiment’s id without exp_, and the variant’s key); each variant’s previewUrl is that link. The variant shows, and keeps showing for 30 minutes as you go on through the site, without anything being counted; ?_dz_preview= with no value ends it. A preview asks not to be indexed.

A visitor’s variant comes from their visitor id and the experiment, so it’s the same every time, and from their first page in the test it’s also kept in a cookie, so changing the share of traffic or the weights only moves visitors who come later:

Name _dz_x
Value <id>.<key> for each experiment, the id without its exp_, joined with ~; x for one the visitor is outside of
Attributes Max-Age of 120 days, Path=/; Secure; SameSite=Lax; not HttpOnly, so the page’s own script can read it

Only people are put in a test. Bots and scripts, browsers that send Global Privacy Control, the workspace’s excluded addresses and sites without full tracking see the control and aren’t counted. Pages served in a test are made private to shared caches, so no cache hands one visitor’s variant to the next.

For each page of a running test it serves to a visitor in it, Digize writes an experiment site event from the server, naming the experiment and the variant. The beacon refuses the name from a browser, so a page can’t fake being seen.

The experiment’s goal is what counts as converting: a form sent (any, or one by its name), a booking, a checkout started, an order paid (whose revenue is counted too), a page reached, a custom event or a page of the test scrolled down 25, 50, 75 or 90% or to the bottom. A visitor converts when they reach it after the first page of the test they saw, on any of the workspace’s sites or booking pages; a scroll goal counts only on the test’s own pages, since a short page anywhere else is seen to the bottom as soon as it opens. Each variant’s results also count the visitors who went on to each outcome, and its revenue per visitor. A visitor seen in two variants (their cookies cleared while the weights changed, say) is left out and counted apart. The results cover an experiment’s first 90 days.

Each variant’s conversion rate is a belief that the visitors counted so far update, and drawing from all of them at once gives each variant’s chance of being best, its chance of beating the control, and a 95% interval for its lift over the control. The verdict reads them:

Verdict When
Too early It has run less than 7 days, or a variant has fewer than 100 visitors.
A winner After that, one variant (the control too) is at least 95% likely to be best.
No difference Each variant has the visitors it takes to tell a 20% lift from chance (95% sure, finding it 80% of the times it’s there), and none is 95% likely to be best.
Keep going Anything else, with about how many visitors each variant still needs.

A seven-day minimum takes in a whole week of weekdays and weekends.

A variant added to a paused experiment sees only the visitors who come after it joins, so it’s compared only with visitors shown the control alongside it: its lift, its interval and its chance of beating the control count the control’s visitors from when it joined, which keeps a change over time (a sale, a season, a new ad) from passing for a lift. Each variant’s chance of being best, the split check and the verdict count the visitors since the newest variant joined, so the clock and the 100 visitors start again for it. Its table row says when it joined. When the visitors aren’t split the way the weights say, by more than luck explains (a chi-square test below 0.001), something is broken (a redirect, a cache, the weights changed) and the results say not to trust them.

Whatever the goal, each experiment also has a verdict on revenue per visitor: what a variant earns for each visitor who saw it, from orders paid after their first page of the test. A change can win on its goal and lose on revenue (more people buy, but cheaper things), so the results show both, apart.

A variant’s revenue per visitor is a visitor’s chance of buying times what a buyer spends. The chance of buying is a belief updated by the visitors and buyers counted, as the conversion rate is; what a buyer spends is drawn as an average order value that starts from two typical buyers across every variant, so one big order moves it only as far as it should and a variant nobody has bought from yet isn’t counted as earning nothing for sure. Drawing both for every variant at once gives each one’s chance of earning the most a visitor, its chance of beating the control, and a 95% interval for its lift. The draws are seeded by the experiment, so the same counts always give the same answer, and a variant that joined later is compared with the control over the same stretch, as above.

Revenue verdict When
Too early It has run less than 7 days, a variant has fewer than 100 visitors, or a variant has fewer than 10 buyers.
A winner After that, one variant (the control too) is at least 95% likely to earn the most a visitor.
Keep going Anything else.

There’s no “no difference” for revenue: order values vary too much for a sample size worked out in advance to mean much.

Ending an experiment names its winner. A content or page variant that won can be served to every visitor (bots included, as the site’s own page would be) straight away, from the edge, until the change is in the site’s own code. Turn serving off once it is, so the page isn’t changed twice. A site variant that won can be served the same way while the domain moves to it.

When a part can’t be swapped in the HTML (it renders in the browser, or the server builds it from data), the site’s code can read the visitor’s variant itself, and render the control when it finds none:

  • On the server, Digize sends the site’s Worker the variants the visitor is in on that request, x-digize-experiments: exp_<id>=b, exp_<id>=a. It drops any copy of the header a browser sends, so the site can trust it. A page whose HTML depends on it needs the variant in any cache key the site uses.
  • In the browser, the _dz_x cookie above, which is set with the first page of the test the visitor sees.

Never set either yourself, and never count which variant a visitor saw: Digize records each page it serves in a test.

Reads need analytics:read; changes need analytics:write, and sites:write as well, since they change what a site serves.

Operation What it does
GET /api/v1/analytics/experiments The workspace’s experiments, newest first, with their set-up and where each stands.
GET /api/v1/analytics/experiments/{id} One experiment and its results so far: each variant’s visitors, conversions, rate, revenue, lift with its interval, chance of being best, outcomes and devices; the rates day by day; whether the split is broken; the verdict with what it needs; and revenue per visitor’s own verdict, with each variant’s buyers, chance of earning the most and lift.
GET /api/v1/analytics/experiments/elements What a content test can change on one of a site’s pages.
POST /api/v1/analytics/experiments Sets one up as a draft.
PATCH /api/v1/analytics/experiments/{id} Changes its set-up, within what it can still change.
POST /api/v1/analytics/experiments/{id}/start Starts a draft or resumes a paused one, or says what keeps it from starting.
POST /api/v1/analytics/experiments/{id}/pause Shows everyone the control until it’s resumed.
POST /api/v1/analytics/experiments/{id}/end Ends it, with its winner, served to everyone or not.
POST /api/v1/analytics/experiments/{id}/serve Starts or stops serving an ended experiment’s winner.
DELETE /api/v1/analytics/experiments/{id} Deletes one that isn’t running; what it counted stays in the site events.

When the workspace’s agent finds a likely fix that changes what visitors see, it offers to test it rather than make the change outright: it reads the page for what can change, adds slots or builds the variant page or a copy of the site with a coding run where it needs to, and sets the experiment up as a draft with a preview link for each variant. Starting one, ending one and serving its winner are changes it proposes, which run only once a member approves them, until an owner lets it do more in AI › Settings. It reports a test’s results as the verdict puts them, and calls no winner before it does. The Conversion review playbook sets up a draft for each such fix it finds, and reports on the experiments running each Monday.