Skip to main content

Server-side Testing Overview

Mida offers two ways to run experiments, depending on where your variant logic lives.

Client-side vs Server-side

Client-sideServer-side
Where variants runBrowser (Mida JS script)Your app/server (SDK)
What you can testPage appearance — CSS, text, HTML, redirectsBackend logic — pricing, algorithms, APIs, mobile app rendering
Flicker riskYes (mitigated by Mida's anti-flicker)None — response is already the right variant
SetupInstall Mida script → use REST API or dashboardCreate in dashboard → install SDK → call getExperiment()
Requires Mida script on pageYesNo (but recommended for goal tracking)
PlatformsWebsitesNode.js, Python, PHP, Ruby, Flutter, Android, iOS

Most Mida users start with client-side experiments — they require no code beyond the Mida script and are managed entirely through the dashboard or REST API.

Server-side testing is the right choice when:

  • Variant differences are in backend logic (pricing engine, recommendation algorithm, search ranking, etc.)
  • You're testing across platforms — web, iOS, Android — and need a single bucketing source of truth
  • You need zero-flicker rendering for highly sensitive pages
  • You're running experiments inside a mobile app where no browser is involved

How server-side testing works in Mida

1. You create the experiment in the dashboard (server-side type)
2. Mida assigns a stable experiment_key (e.g. "homepage-pricing-v2")
3. On each request, your server calls the SDK:
variant = await mida.getExperiment(experimentKey, distinctUserId)
4. Your code branches on "Control", "Variant 1", "Variant 2", …
5. When a conversion happens, you call:
await mida.setEvent(eventName, distinctUserId)
6. Results appear in the Mida dashboard as usual

The SDK handles bucketing (deterministically assigning a user to a variant), session continuity (same user always gets same variant), and goal tracking — so the dashboard stats work the same as client-side experiments.


Experiment key vs Project key

KeyWhat it isWhere to find it
Project keyIdentifies your Mida site/projectDashboard → Settings → API
Experiment keyIdentifies a specific server-side experimentDashboard → Experiment → SDK panel

Both are needed for SDK usage. The REST API uses Project key for management. The SDK uses Project key (to init the client) and Experiment key (to get variant assignments).


Variant names are the contract

Mida uses the same fixed naming convention for both client-side and server-side experiments:

RoleNameNotes
Original experienceControlDo not include in create-experiment variants array
First treatmentVariant 1
Second treatmentVariant 2
Nth treatmentVariant N

Your SDK code must branch on these exact strings — they are the interface between the dashboard configuration and your application code.

const variant = await mida.getExperiment('my-experiment-key', userId);

if (variant === 'Control') {
// original logic
} else if (variant === 'Variant 1') {
// treatment logic
}

Goal tracking

Server-side experiments track goals the same way as client-side ones — by event name. Call setEvent() from your server when a conversion happens.

Event typesetEvent() call
Custom eventmida.setEvent('signup_completed', userId)
Revenue / purchasemida.setEvent('Purchase', userId, { revenue: 49.99, quantity: 1, currency: 'USD' })

The event name must match what you configured as the goal in the Mida dashboard.

Goal tracking from browser

If the conversion happens on a web page (e.g. reaching a thank-you URL), you can still track it client-side through the Mida script — no need to call setEvent() from the server.


Next steps

  • Quickstart → — set up your first server-side experiment in 5 steps
  • SDK catalog → — install instructions for Node.js, Python, PHP, Ruby, Flutter, and more
  • REST API → — manage experiments, goals, and events programmatically