ProveBetter

Install the SDK

Two snippets, no dependencies. The boot script is ~1.4 KB gzipped and loads the full SDK (~4.2 KB gzipped) asynchronously. It works on any website — plain HTML, React, Vue, Shopify, anything that can include a script tag.

no test selected → global

Choose one path per test — snippet or API, not both — otherwise visitors get counted twice. Server-side? The integration guide covers assignment, stickiness, and failure handling.

Choose a test

Picking a test pre-fills its key into every snippet below. Link here from a results page with /install?test=<key>.

Serving from a different domain?

The snippets below already point at https://your-provebetter-host. If your site loads this page from a different origin, overwrite it here:

1Paste the boot script in <head>

Synchronous, first in <head>, on every page you want to test. It assigns the visitor a first-party cookie (pb_vid, 180 days) so they always see the same variant, and hides test elements for at most 2 seconds while their variant loads — visitors on a very slow connection simply see the control page and are not counted in the test.

boot script — every page, first in <head>
<script src="https://your-provebetter-host/boot.js"></script>

2Mark up your variants

Wrap each variant's content in a container with data-pb="your-test-key" — replace with your test's key from the Tests page or pick it above. The control variant ships visible; challengers ship hidden so the page is correct even before (or without) JavaScript. The SDK reveals exactly one variant per visitor.

variant markup
<div data-pb="your-test-key">
  <div data-pb-variant="A">Control headline</div>
  <div data-pb-variant="B" hidden>Challenger headline</div>
</div>

<!-- Hide an element when a specific variant wins -->
<div data-pb-hide="your-test-key:B">Shown only when B is NOT active</div>

3Track conversions

Call ProveBetter.track() on the action you're measuring — a signup, a purchase, any click. With one active test on the page, no test key is needed. Exposures are recorded automatically the moment a variant is applied.

conversion tracking
// Conversion — attributed to the page's single active test
ProveBetter.track("signup_click");

// Conversion attributed explicitly to this test
ProveBetter.track("purchase", { test: "headline-test" });

// Read the resolved variant in your own code
const v = ProveBetter.variant("headline-test"); // "A".."E" or null

Check that your snippet is live

After pasting, open your site, and ProveBetter checks here that the snippet actually booted.

Pick a test above first — the check verifies one test's snippet on your site.

QA checklist