diff --git a/components/ExperimentsView.tsx b/components/ExperimentsView.tsx index f197a48..884d270 100644 --- a/components/ExperimentsView.tsx +++ b/components/ExperimentsView.tsx @@ -474,7 +474,7 @@ const ExperimentDetailView: React.FC<{ ); } - if (experiment.verdict && primaryResult && didResults) { + if (experiment.verdict || didResults) { const prob = Math.round((experiment.verdict_probability || 0) * 100); const radius = 60; const circumference = 2 * Math.PI * radius; @@ -542,19 +542,31 @@ const ExperimentDetailView: React.FC<{ {/* Render specific metrics: Units, Revenue, CVR, BSR/ACOS (if available in didResults) */} - {['units', 'revenue', 'cvr', 'acos'].map(metric => { - const res = didResults.metrics[metric]; + {['units', 'revenue', 'cvr', 'acos', 'sessions', 'roas', 'ctr'].map(metric => { + const res = didResults?.metrics?.[metric]; if (!res) return null; const isPositiveGood = !['acos', 'bsr'].includes(metric); const isGood = isPositiveGood ? res.lift_percent >= 0 : res.lift_percent <= 0; return ( - {METRIC_LABELS[metric] || metric} - {formatMetricValue(res.control_after, metric)} - {formatMetricValue(res.treatment_after, metric)} + + {METRIC_LABELS[metric] || metric} + {metric === experiment.primary_metric && ( + PRIMARY + )} + + {formatMetricValue(res.treatment_before, metric)} + {formatMetricValue(res.treatment_after, metric)} - = 0 ? '' : 'rotate-180') : 'rotate-180'}`} fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={3}> - {res.lift_percent >= 0 ? '+' : ''}{res.lift_percent.toFixed(1)}% +
+ + = 0 ? '' : 'rotate-180') : 'rotate-180'}`} fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={3}> + {res.lift_percent >= 0 ? '+' : ''}{res.lift_percent.toFixed(1)}% + + + DiD: {res.did_estimate >= 0 ? '+' : ''}{formatMetricValue(res.did_estimate, metric)} + +
);