Skip to content

Visual Page Experiments

B2B SaaSE-commerceAgencies

Run flicker-free A/B tests on Plasmic pages

Design variants visually in Plasmic Studio and serve them flicker-free on first HTML using @apex-inc/next and @apex-inc/react on Codegen or Headless API (or use snippet tests on Plasmic hosting).

Flicker-free first HTML on Codegen and Headless API (snippet tests on Plasmic hosting).

6 min read20 min setupUpdated
Web designer and frontend engineer smiling together over a sunlit pale birch drafting table inside a creative design loft.
Let designers build variants freely in Plasmic Studio while Apex serves the assigned arm cleanly on the first HTML byte.

Interactive Plasmic architecture & traffic-split simulator

Match your Plasmic deployment mode and model Control vs. Variant traffic

Compare Codegen SSR, Headless API SSR, and Plasmic hosting side-by-side, and adjust your Control vs. Variant split cleanly from 10% to 50%.

Illustrative Plasmic test · 50/50 split
ApexExperiments · Plasmic + Apex
18,000

Split directly between Control and Variant B.

50% Control / 50% Variant B

50/50 split reaches statistical confidence fastest (workspace global holdout is separate, default 5%).

First HTML behavior

Flicker-free

Zero flash (SSR first HTML)

Control (50%)

9,000

~306 illustrative conversions

Variant B (50%)

9,000

~369 illustrative conversions

Required install & setup

npm install @apex-inc/next @apex-inc/react

Use a plain Plasmic Global Variant (not Split content). Server calls assignExperiments() and passes assignments to <ApexProvider>; client wraps the variant context with useApexVariant + isTreatmentVariant from @apex-inc/react.

Preview URL: ?_apex_preview=variant_a&_apex_exp=exp_123

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 experiment finishes.
Coordinate Plasmic syncs during live tests

The complete playbook

Step-by-step setup, worked math, and real limits.

Steps, technical details, and live pricing.

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

  1. Match the integration path to your Plasmic setup

    Run npm install @apex-inc/next @apex-inc/react for 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).

  2. 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/react inside a user-owned component outside components/plasmic/ so plasmic sync never overwrites it.

  3. 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.

  4. Assign on the server with @apex-inc/next for zero flicker

    Add apexVisitorMiddleware in middleware.ts, call assignExperiments() from @apex-inc/next on the server (using getServerSideProps rather than getStaticProps on Pages Router), and pass assignments + search into <ApexProvider> from @apex-inc/react so first HTML matches the assigned arm.

  5. 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.Provider inside a user-owned component outside components/plasmic/ using useApexVariant and isTreatmentVariant from @apex-inc/react. Keeping your wrapper outside components/plasmic/ guarantees future plasmic sync runs 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 control and variant_a), then pass variation={{ ['ext.' + id]: variant }} directly to PlasmicRootProvider. Do not also call Plasmic's getActiveVariation, 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/experiments if you want to minimize flash.
Hands of a design-systems engineer arranging blank matte paper swatches and neutral color cards on a pale oak studio bench.
Keep your Apex variant wrapper outside components/plasmic/ so future plasmic sync runs never overwrite your test wiring.

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
  1. Wire apexVisitorMiddleware from @apex-inc/next in middleware.ts so every visitor gets an apex_vid cookie on arrival.
  2. Call assignExperiments() from @apex-inc/next on the server (App Router Server Component, or getServerSideProps instead of getStaticProps on Pages Router).
  3. Pass assignments and search into <ApexProvider> from @apex-inc/react (and read the arm with useApexVariant and isTreatmentVariant from @apex-inc/react) so preview URLs like ?_apex_preview=variant_a&_apex_exp=exp_123 render the exact variant in first HTML.
Marketing director standing near a tall sunny loft window discussing landing page experiments with his team.
@apex-inc/next resolves the assigned arm server-side before HTML streams, eliminating client-side headline flicker on Codegen and Headless API.

Sync safety & graduating winners

Keep three Plasmic-specific details in mind while running tests:

  • Each Plasmic test compares two versions (control plus 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 / scheduleScenario volumeFree allowance / basisRateApex cost
Events
Page views and conversion events (25,000 monthly web events)
25,000 / mo1M / month$5 per 100K events$0
Orchestrations
Server-side variant assignments via @apex-inc/next (Zero-flicker assignment on first HTML byte)
25,000 / mo1M / 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)

ExpenseTypical rangeNotes
External client-side A/B overlay script$0/moReplaced directly by @apex-inc/next server assignment

Launch with your AI agent

Create and wire your Plasmic experiment safely via MCP

Before designing or editing a Plasmic page, ask your coding agent to create the experiment in Apex and scaffold the safe user-owned wrapper outside components/plasmic/.

1Add Apex to your editor

Install in Grok Build

Opens Grok Build and adds Apex. Nothing to configure.

2Tell your agent

Prompt for your AI editor

In my Apex workspace, call create_experiment for our Plasmic homepage hero test, install @apex-inc/next and @apex-inc/react, then wire assignExperiments on the server and a user-owned Plasmic global variant wrapper using useApexVariant and isTreatmentVariant from @apex-inc/react outside components/plasmic/ so plasmic sync never overwrites it.

The first time your agent calls Apex, it gives you a link to approve in the browser. There is no key to paste. In Grok Build you can also run /setup-apex.

See how editor setup works step by step

plasmic-next-site · Grok BuildWaiting for approval
Agent
You

Set up Apex in this repo.

Set up Apex · 0 of 4
  • Signed in
  • Workspace named
  • Events arriving
  • Conversion picked
  • Stripe

Your move

Design in Plasmic Studio. Measure on verified revenue.

Connect @apex-inc/next and @apex-inc/react to your Plasmic global variants in 20 minutes so Next.js SSR tests render cleanly on first HTML.