How it works without Apex
Match Apex to how you ship Plasmic: install @apex-inc/next and @apex-inc/react for flicker-free first-HTML SSR on Codegen (plain Global Variant wrapped outside components/plasmic/ with useApexVariant and isTreatmentVariant from @apex-inc/react, not Split content) or Headless API (pass variation to PlasmicRootProvider without getActiveVariation). On Plasmic hosting, install the Apex snippet for client-side snippet tests.
How Apex does it for you
Apex mints the visitor cookie in Next.js middleware, resolves the assigned arm server-side before HTML streams so visitors see zero layout flicker, respects ?_apex_preview for QA, and scores variants on real conversions.
How to set this up in 5 steps
Match the integration path to your Plasmic setup
Run npm install
@apex-inc/next@apex-inc/reactfor flicker-free first-HTML SSR on Codegen (using a plain Global Variant, NOT Plasmic Split content) or Headless API. On Plasmic hosting (no custom Next.js code), use the Apex tracking snippet for snippet experiments (may briefly show Control; optional anti-flicker CSS available).Keep Apex wrapper code outside components/plasmic/
For Codegen projects, do not create the test under Plasmic's Split content tab. Use a plain Global Variant and wrap its Context.Provider with
useApexVariant() and isTreatmentVariant() from@apex-inc/reactinside a user-owned component outside components/plasmic/ so plasmic sync never overwrites it.Wire Headless API external IDs without double-splitting
For Headless API projects, set the Plasmic Split external ID to your Apex experiment ID (and slice external IDs to control and variant_a), pass variation={{ ['ext.' + id]: variant }} to PlasmicRootProvider, and do NOT also call Plasmic's getActiveVariation.
Assign on the server with
@apex-inc/nextfor zero flickerAdd
apexVisitorMiddlewarein middleware.ts, call assignExperiments() from@apex-inc/nexton the server (using getServerSideProps rather than getStaticProps on Pages Router), and pass assignments + search into <ApexProvider> from@apex-inc/reactso first HTML matches the assigned arm.QA both arms and promote the winner manually in Plasmic Studio
Verify both arms with
?_apex_preview=control&_apex_exp=<id> and?_apex_preview=variant_a&_apex_exp=<id> before activating. When a test concludes, copy the winning changes into the base layer inside Plasmic Studio.
Pick your Plasmic setup
Plasmic teams ship in three different ways, and each maps to a specific Apex setup:
- Codegen (`plasmic sync` into Next.js, flicker-free SSR): Do not create the test under Plasmic's Split content tab (that lets Plasmic split visitors itself). Instead, create a plain Global Variant in Plasmic Studio and wrap its generated React
Context.Providerinside a user-owned component outsidecomponents/plasmic/usinguseApexVariantandisTreatmentVariantfrom@apex-inc/react. Keeping your wrapper outsidecomponents/plasmic/guarantees futureplasmic syncruns never overwrite it. - Headless API (`@plasmicapp/loader-nextjs`, flicker-free SSR): Set the Plasmic Split external ID to your Apex experiment ID (and slice IDs to
controlandvariant_a), then passvariation={{ ['ext.' + id]: variant }}directly toPlasmicRootProvider. Do not also call Plasmic'sgetActiveVariation, or two split engines will fight over the same visitor. - Plasmic Hosting (no custom Next.js repo): Use the tracking snippet and snippet experiments. Because there is no server code to run
@apex-inc/next, visitors may briefly see the original version before the variant swaps in; add the optional anti-flicker CSS from/docs/snippet/experimentsif you want to minimize flash.

Zero-flicker Next.js SSR wiring
First HTML is flicker-free only when the server already assigned the visitor. On Next.js Codegen or Headless API, install both packages:
npm install @apex-inc/next @apex-inc/react- Wire
apexVisitorMiddlewarefrom@apex-inc/nextinmiddleware.tsso every visitor gets anapex_vidcookie on arrival. - Call
assignExperiments()from@apex-inc/nexton the server (App Router Server Component, orgetServerSidePropsinstead ofgetStaticPropson Pages Router). - Pass
assignmentsandsearchinto<ApexProvider>from@apex-inc/react(and read the arm withuseApexVariantandisTreatmentVariantfrom@apex-inc/react) so preview URLs like?_apex_preview=variant_a&_apex_exp=exp_123render the exact variant in first HTML.

Sync safety & graduating winners
Keep three Plasmic-specific details in mind while running tests:
- Each Plasmic test compares two versions (
controlplus one treatment). - Apex's live-test check runs when someone edits code in an editor; it does not see a
plasmic sync. Agree with designers not to edit the live treatment variant until the test ends. - Once Apex declares a winner, apply the winning variant into the base layer inside Plasmic Studio, run
plasmic sync, and remove the temporary global variant wrapper.
What this costs on Apex
Live Apex pricing · Pay-as-you-go
Estimated Apex cost for Marketing site running 25,000 monthly Plasmic landing visits and A/B assignments
$0 / month
Covered by monthly free allowances.
| Apex meter / schedule | Scenario volume | Free allowance / basis | Rate | Apex cost |
|---|---|---|---|---|
Events Page views and conversion events (25,000 monthly web events) | 25,000 / mo | 1M / month | $5 per 100K events | $0 |
Orchestrations Server-side variant assignments via @apex-inc/next (Zero-flicker assignment on first HTML byte) | 25,000 / mo | 1M / month | $5 per 100K assignments | $0 |
@apex-inc/next is published on npm and works with App Router and Pages Router with zero extra add-on fees. History: 13 months no card, 3 years with card, 7 years once you've paid an invoice. Live pricing.
Third-party and campaign costs (not paid to Apex)
| Expense | Typical range | Notes |
|---|---|---|
| External client-side A/B overlay script | $0/mo | Replaced directly by @apex-inc/next server assignment |
