diff --git a/frontend/src/scenes/experiments/ExperimentView/components.tsx b/frontend/src/scenes/experiments/ExperimentView/components.tsx index 2476fe7136dbe..54e807058cee8 100644 --- a/frontend/src/scenes/experiments/ExperimentView/components.tsx +++ b/frontend/src/scenes/experiments/ExperimentView/components.tsx @@ -1,7 +1,7 @@ import '../Experiment.scss' import { IconCheck, IconX } from '@posthog/icons' -import { LemonBanner, LemonButton, LemonDivider, LemonTag, LemonTagType, Link } from '@posthog/lemon-ui' +import { LemonBanner, LemonButton, LemonDivider, LemonTag, LemonTagType, Link, Tooltip } from '@posthog/lemon-ui' import { Empty } from 'antd' import { useActions, useValues } from 'kea' import { AnimationType } from 'lib/animations/animations' @@ -41,11 +41,21 @@ export function VariantTag({ variantKey }: { variantKey: string }): JSX.Element } export function ResultsTag(): JSX.Element { - const { areResultsSignificant } = useValues(experimentLogic) + const { areResultsSignificant, significanceDetails } = useValues(experimentLogic) const result: { color: LemonTagType; label: string } = areResultsSignificant ? { color: 'success', label: 'Significant' } : { color: 'primary', label: 'Not significant' } + if (significanceDetails) { + return ( + + + {result.label} + + + ) + } + return ( {result.label} diff --git a/frontend/src/scenes/experiments/experimentLogic.tsx b/frontend/src/scenes/experiments/experimentLogic.tsx index 31de23b9d696f..4efc2f987e29a 100644 --- a/frontend/src/scenes/experiments/experimentLogic.tsx +++ b/frontend/src/scenes/experiments/experimentLogic.tsx @@ -773,6 +773,7 @@ export const experimentLogic = kea([ return experimentResults?.significant || false }, ], + // TODO: remove with the old UI significanceBannerDetails: [ (s) => [s.experimentResults], (experimentResults): string | ReactElement => { @@ -819,6 +820,32 @@ export const experimentLogic = kea([ return '' }, ], + significanceDetails: [ + (s) => [s.experimentResults], + (experimentResults): string => { + if (experimentResults?.significance_code === SignificanceCode.HighLoss) { + return `This is because the expected loss in conversion is greater than 1% (current value is ${( + (experimentResults?.expected_loss || 0) * 100 + )?.toFixed(2)}%).` + } + + if (experimentResults?.significance_code === SignificanceCode.HighPValue) { + return `This is because the p value is greater than 0.05 (current value is ${ + experimentResults?.p_value?.toFixed(3) || 1 + }).` + } + + if (experimentResults?.significance_code === SignificanceCode.LowWinProbability) { + return 'This is because the win probability of all test variants combined is less than 90%.' + } + + if (experimentResults?.significance_code === SignificanceCode.NotEnoughExposure) { + return 'This is because we need at least 100 people per variant to declare significance.' + } + + return '' + }, + ], recommendedExposureForCountData: [ (s) => [s.minimumDetectableChange], (mde) =>