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);
|