Skip to main content

A/B Testing Implementation Guide

Purpose: Technical implementation details for A/B testing on pre-launch landing pages Repository: juniro-web-launch Tool: Posthog (feature flags + analytics) Last Updated: January 2026


Overview

This document covers the technical implementation of A/B testing for the Juniro pre-launch landing pages. For the strategic testing plan and copy variants, see A/B Testing Plan.


Architecture

┌─────────────────────────────────────────────────────────────┐
│ Posthog Feature Flags │
│ parent_headline_variant | parent_cta_variant │
│ provider_headline_variant | provider_cta_variant │
└─────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────┐
│ useABTest.ts Hooks │
│ useParentVariants() | useProviderVariants() │
└─────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────┐
│ Landing Pages │
│ page.tsx (parents) | providers/page.tsx │
└─────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────┐
│ WaitlistForm.tsx │
│ Tracks variants on form submission │
└─────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────┐
│ /api/waitlist → Posthog + Loops │
│ Stores variant info for conversion attribution │
└─────────────────────────────────────────────────────────────┘

File Structure

juniro-web-launch/src/
├── config/
│ └── ab-variants.ts # Copy variants configuration
├── hooks/
│ └── useABTest.ts # React hooks for loading variants
├── components/
│ ├── Analytics.tsx # Posthog initialization + helpers
│ └── WaitlistForm.tsx # Form with variant tracking
├── app/
│ ├── page.tsx # Parent landing page (uses variants)
│ ├── providers/page.tsx # Provider landing page (uses variants)
│ └── api/waitlist/route.ts # API with variant tracking

Posthog Feature Flags Setup

Step 1: Create Feature Flags

In Posthog (app.posthog.com) → Feature Flags → New feature flag:

Flag NameVariantsRollout
parent_headline_variantA: 50%, B: 50%100% of users
parent_cta_variantA: 50%, B: 50%100% of users
provider_headline_variantA: 50%, B: 50%100% of users
provider_cta_variantA: 50%, B: 50%100% of users

Step 2: Configure Each Flag

  1. Key: Enter flag name exactly as shown above
  2. Served value: Select "Multiple variants with rollout percentages (A/B/n test)"
  3. Variant keys:
    • Variant key: A, Rollout: 50%
    • Variant key: B, Rollout: 50%
  4. Release conditions: Roll out to 100% of users
  5. Evaluation runtime: "Both client and server"
  6. Enable feature flag: ✅ Checked
  7. Create usage dashboard: ✅ Checked
  8. Click Save

Run one test at a time for cleaner data:

  1. Enable only parent_headline_variant
  2. Disable the other 3 flags
  3. After 2 weeks, pick winner (set to 100%), enable next flag

To disable a flag: Uncheck "Enable feature flag" and Save.


Copy Variants Configuration

Located in src/config/ab-variants.ts:

Parent Page Variants

ElementVariant A (Control)Variant B (Test)
Headline"Stop Searching. Start Booking.""Finding the right activities for your kids shouldn't be this hard."
Subheadline"Find and book the best classes...""Trusted activities, reviewed by parents..."
CTA"Get Early Access""Notify Me When We Launch"
Form Helper"Be the first to know when we launch""Be the first to know when activities open near you"
Interest Label"What activities interest your child?""What are you looking for your child right now?"

Provider Page Variants

ElementVariant A (Control)Variant B (Test)
Headline"Fill Your Classes. Grow Your Business.""Get discovered by parents actively looking for activities."
Subheadline"Reach families actively looking...""Reach new families without spending on ads..."
Inclusion Copy"Perfect for studios, schools, camps...""Built for businesses and independent instructors alike."
CTA"Join as Provider""Apply to Join"
Scarcity Copy"Limited early provider slots per city""Onboarding providers in your city now"
Provider Type Label"I am a""I run a"

Event Tracking

Events Implemented

EventWhen FiredProperties
$pageviewPage loadsAuto-captured by Posthog
ab_variants_loadedVariants loaded from Posthogpage, headline_variant, cta_variant
form_startUser clicks email field (once)userType, headline_variant, cta_variant
interest_selectedUser selects an interestinterest, userType, headline_variant, cta_variant
form_errorForm submission failserror_type, userType, headline_variant, cta_variant
waitlist_signupForm submitted successfullyuserType, city, ab_headline_variant, ab_cta_variant, + more

Event Flow

User visits page


$pageview (auto)


ab_variants_loaded (when Posthog flags load)


form_start (user clicks email field)

├──▶ interest_selected (optional, per interest clicked)


Form Submit

├──▶ form_error (if failed)

└──▶ waitlist_signup (if success) → Redirect to thank-you

Posthog Dashboards Setup

Create these 3 insights in Posthog:

Dashboard 1: Core Funnel

  1. Go to InsightsNew insightFunnels
  2. Add steps:
    • Step 1: $pageview
    • Step 2: form_start
    • Step 3: waitlist_signup
  3. Add breakdown: userType
  4. Add breakdown: ab_headline_variant
  5. Save as "Core Funnel"

Dashboard 2: Drop-off Analysis

  1. Go to InsightsNew insightFunnels
  2. Add steps:
    • Step 1: form_start
    • Step 2: form_error
  3. Add breakdown: error_type
  4. Add breakdown: ab_headline_variant
  5. Save as "Drop-off Analysis"

Dashboard 3: Motivation Signal

  1. Go to InsightsNew insightFunnels
  2. Add steps:
    • Step 1: interest_selected
    • Step 2: waitlist_signup
  3. Add breakdown: interest
  4. Add breakdown: city
  5. Save as "Motivation Signal"

Create Combined Dashboard

  1. Go to DashboardsNew dashboard
  2. Name: "A/B Testing Analytics"
  3. Add all 3 saved insights

How Variant Assignment Works

Posthog uses sticky assignment:

  1. First visit: User assigned to A or B based on anonymous ID (cookie)
  2. All future visits: Same user always sees same variant
  3. 50/50 split: Roughly half of unique visitors get A, half get B

To test both variants yourself:

  • Variant A: Your current browser
  • Variant B: Incognito window or different browser

Picking a Winner

After running a test for 1-2 weeks (or 100+ conversions):

In Posthog:

  1. Go to Feature Flags → Click the flag
  2. Check conversion rates by variant in your dashboard
  3. Update Variant keys:
    • Winning variant: 100%
    • Losing variant: 0%
  4. Click Save

Decision Criteria:

  • If one variant clearly wins (>10% improvement): Pick it
  • If results are close: Pick whichever feels more honest
  • If B wins but feels manipulative: Consider sticking with A

Code Reference

Using Variants in Pages

// Parent page
import { useParentVariants } from '@/hooks/useABTest'

export default function HomePage() {
const ab = useParentVariants()

return (
<h1>
{ab.headline.main}
<span>{ab.headline.highlight}</span>
</h1>
<p>{ab.subheadline}</p>
<WaitlistForm
userType="parent"
ctaText={ab.cta}
interestLabel={ab.interestLabel}
variants={ab.variants}
/>
)
}

Available Hook Returns

// useParentVariants()
{
isLoaded: boolean,
headline: { main: string, highlight: string },
subheadline: string,
cta: string,
formHelper: string,
interestLabel: string,
variants: { headline: 'A' | 'B', cta: 'A' | 'B' }
}

// useProviderVariants()
{
isLoaded: boolean,
headline: { main: string, highlight: string },
subheadline: string,
inclusionCopy: string,
cta: string,
scarcityCopy: string,
providerTypeLabel: string,
variants: { headline: 'A' | 'B', cta: 'A' | 'B' }
}

Troubleshooting

Variants Not Loading

  1. Check Posthog key is set: NEXT_PUBLIC_POSTHOG_KEY in .env.local
  2. Verify flag is enabled in Posthog
  3. Check browser console for Posthog errors
  4. Default behavior: Shows variant A if flags fail to load

Events Not Appearing in Posthog

  1. Wait 1-2 minutes (Posthog has slight delay)
  2. Check Posthog → Live Events to see real-time events
  3. Verify NEXT_PUBLIC_POSTHOG_KEY is correct

Testing Locally

  1. Posthog works in development
  2. Use incognito to get a fresh user assignment
  3. Check Network tab for posthog requests

Test Schedule

DatesTestFlag to Enable
Week 1-2Parent Headlineparent_headline_variant
Week 3-4Parent CTAparent_cta_variant
Week 5-6Provider Headlineprovider_headline_variant
Week 7-8Provider CTAprovider_cta_variant