Cross-device experiments
Most A/B testing tools bucket on a browser cookie. That works while a visitor stays anonymous on one laptop. The moment they sign in on their phone, switch browsers, or clear cookies, a cookie-only tool treats one human as two separate strangers.
That causes three quiet failures:
- Version flip-flopping. A signed-in customer sees Variant A at their desk and Control on their phone ten minutes later.
- Double-counted denominators. One person who views your page on two devices and buys once looks like two participants and one conversion (50% instead of 100%).
- Polluted sample counts. Internal staging checks and QA sessions bleed into live experiment totals unless environments stay separate.
Apex fixes all three on the same identity layer that powers your customer records.
How Apex keeps one person on one version
When your app calls identify(userId, traits) at sign-in, Apex links the visitor's browser (apex_vid) to your stable customer record and writes a first-party signed-in cookie (apex_eid) for that person.
From that point on:
- Deterministic bucketing follows the person. Both the web snippet and server-side assignment (
assignExperiments/GET /api/experiments/{id}/assign) bucket on the person's canonical identifier when present, not just the device cookie. - Every signed-in device gets the same arm. If Priya enters Variant A on Chrome at work and later opens your app or mobile site on her iPhone, Apex serves Variant A again.
- No probabilistic guessing. Apex never merges two browsers by IP address, screen size, or user agent. Two devices join only when your app asserts the same
userIdon both.
Info
To stop a browser from spoofing another customer's identity, sign your identify() calls on the server with userHash. See Signed sign-ins.
How Apex counts each person once
When Apex computes experiment results, exposed subjects, and wiring counts, it collapses every stitched device belonging to the same customer back to a single canonical subject key (contact:<id>).
| What happens in the wild | Cookie-only A/B tool | Apex |
|---|---|---|
| Same customer visits on laptop and phone | Counted as 2 people; may see both versions | Counted as 1 person; sees the same version on both |
| Customer reloads the page 4 times | Often inflates exposure or tester counts | Counted as 1 exposed person (first exposure wins) |
| Customer sees Variant A on laptop, buys on phone | Conversion orphaned from the laptop exposure | Conversion joins Variant A on the customer's single record |
| Anonymous visitor never signs in | Counted as 1 browser | Counted as 1 browser (never merged on a guess) |
Because results, exposed subjects, and wiring checks all share the same canonical subject rule, the numbers across every screen in the dashboard reconcile to the exact same headcount.
How staging and beta stay out of production
Testing an experiment on staging or localhost shouldn't change a single production number.
- Environment-scoped identities. Visitor identities on staging or preview hosts are stored under an audience-scoped key (
<visitorId>::betaor<visitorId>::dev), isolated from production contacts. - Production by default. Experiment results, subjects, and sample gates default to production traffic only.
- All builds when verifying wiring. Switch the build filter to All builds while QA'ing on staging to confirm every arm fires and cross-device dedup holds, while production stays cleanly at
0.
What you need to wire
Cross-device consistency and count-once results work automatically once your app identifies signed-in users:
Install the snippet or SDK
Add the Apex snippet or @apex-inc/sdk on your site, and the mobile SDK if you have an iOS or Android app.
Call identify() at sign-in with your user ID
Pass your stable database or auth provider ID (userId) on login and signup so Apex can stitch every device the person signs into.
import { identify } from "@apex-inc/sdk";
identify(user.id, {
email: user.email,
name: user.name,
});
Forward apex_vid on server-side events
When a conversion happens off-page (such as a Stripe webhook or backend checkout), send the customer's userId (and apex_vid when available) via the Server Events API so the sale credits the right experiment arm.
Related
- Identity SDK reference:
identify(), traits, and B2B accounts - Signed sign-ins: HMAC verification for browser
identify()calls - Experiments: assignment, statistical confidence, and graduation
- Data and identity: interactive walkthrough of one customer across devices