171b193498
Sticky 50/50 variant assignment via gw_ab_hero cookie, server-rendered so no flicker. Tracks exposures, CTA clicks, and booking conversions to ab_events (table self-creates on first POST). Bot UAs are dropped; exposures/clicks dedupe per session. - ?ab=control / ?ab=free_emphasis forces and persists a variant - /owner/experiments shows per-variant CVR and relative lift - AB only runs on the marketing surface Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
16 lines
656 B
SQL
16 lines
656 B
SQL
-- A/B test event log. One row per exposure / cta_click / conversion.
|
|
-- Kept narrow on purpose: the goal is "did variant X get more conversions
|
|
-- than control" — not full session reconstruction.
|
|
create table if not exists ab_events (
|
|
id bigserial primary key,
|
|
experiment text not null,
|
|
variant text not null,
|
|
event_type text not null check (event_type in ('exposure', 'cta_click', 'conversion')),
|
|
anon_id text not null,
|
|
meta jsonb not null default '{}'::jsonb,
|
|
created_at timestamptz not null default now()
|
|
);
|
|
|
|
create index if not exists ab_events_experiment_variant_idx
|
|
on ab_events (experiment, variant, event_type, created_at desc);
|