Growth teams like an experiment to start in the page: the user is hashed into a bucket, a holdout is skipped, and the variant is rendered before the first paint. When the bucketing salt, the traffic splits, and the holdout rules all run in the browser, you have published the experiment design — and a way to opt into the better price, the lighter paywall, or the treatment you were never meant to see.
A competitor can read which tests you are running. A user can hook the assigner and pick the cheaper variant. Neither is acceptable if checkout, entitlements, or "this user is in holdout" decisions later trust that client assignment.
What actually ships
A typical client-side experiment script includes:
- Experiment catalog — keys, start and stop dates, and the list of variants you have not announced yet.
- Traffic splits and salts — the hash, the percentages, and the sticky-assignment rules.
- Holdouts and layers — mutually exclusive layers, global holdouts, and "already in experiment X" exclusions.
- Targeting predicates — country, plan, new-user flags, and internal-staff overrides.
- Exposure hooks — when the script calls a variant "seen", and whether that is only a
windowevent.
The analytics pixel can live on a vendor. The function that decides the price or the paywall is often already in the bundle.
How it gets lifted
People search the bundle for strings like holdout, bucket, or a function named assignVariant.
export const TESTS = { "pricing-2026q4": { salt: "p4-live", split: { control: 50, "annual-emphasis": 40, "lower-intro": 10 }, exclude: ["enterprise", "holdout-global"], }, "paywall-soft": { salt: "pw2", split: { control: 80, "soft-wall": 20 } }, }; export function assignVariant(user, key) { const t = TESTS[key]; if (user.flags.some((f) => t.exclude?.includes(f))) return "holdout"; const n = hash(user.id + t.salt) % 100; return pick(t.split, n); } Once TESTS is public, the unreleased "lower-intro" price is no longer unreleased, and a shopper can hook assignVariant so it always returns that arm. If the checkout page trusts the variant name from localStorage, you have turned an experiment into a self-serve discount.
What actually protects you
Move assignment that affects money or entitlements off the client
- Authoritative bucketing belongs on the server, against the current catalog, the real user, and a logged exposure.
- Unreleased or sensitive arms should not be described in a public bundle at all.
- Staff overrides must be authorized server-side, not unlocked by a query parameter in the page.
Protect a local render hint if you still want one
A local hint can reduce flicker for purely visual tests. For that chunk:
- Ship only harmless presentational experiments, not pricing, paywall, or entitlement keys.
- Bundle the hint separately from checkout and billing UI.
- Apply stronger-than-mangling protection (control-flow flattening or VM-based compilation) to any catalog you still ship.
- Leave source maps off the public CDN.
- Re-assign, or at least confirm, the variant on the server before you charge or unlock a feature.
Do not treat the client as an experiment authority
If a price or a feature is granted because the page said lower-intro, anyone can write that string into storage. Revenue-affecting tests need a server that already knows the bucket.
Practical checklist
- [ ] Pricing, paywall, and entitlement experiments are assigned or confirmed on the server.
- [ ] Unreleased arms and salts are not described in the public bundle.
- [ ] Any local hint is limited to presentational tests, split from checkout UI, and protected with stronger-than-Terser obfuscation.
- [ ] Source maps for the assigner are not on the public CDN.
- [ ] Hooking the assigner cannot change the charged price or an entitlement.
- [ ] Exposures that matter for analysis are logged server-side.
- [ ] The UI does not treat a localStorage variant as a completed assignment for money.
Honest limits
Curious users will still compare screenshots of two variants. Obfuscation does not hide a visual change; it raises the cost of reading the catalog and forcing a bucket. If an arm cannot be public, do not put it in JavaScript you send to every browser.
Summary
A client-side A/B script ships the work that makes it powerful: the catalog, the salts, and the holdout rules. Use a visual hint if you must, protect that chunk, and let the server be the only path that assigns a price or an entitlement.
Disclosure: I work on VEILVM, a JavaScript VM-protection service. Free browser tier (3 runs/day, up to 5 KB) and a Pro plan at $9/month or $79/year with API access. Try the playground at vm.ldvmp.com.
