Skip to content

Commit fe78142

Browse files
committed
Add some documentation
1 parent afe01fc commit fe78142

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

shared/js/background/components/abn-experiments.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,26 @@ export class PixelMetric {
110110
}
111111
}
112112

113+
/**
114+
* A/B/N testing framework: metrics.
115+
*
116+
* This component handles metrics needed for A/B testing. It handles the rate-limiting required
117+
* to define and send metrics as per the documentation in Asana (https://app.asana.com/0/1208889145294658/1208747415972722/f)
118+
*
119+
* Usage:
120+
* - The main entry point is `markExperimentEnrolled`. This should be used to move an assigned experiment to
121+
* 'enrolled' state when the user first sees the treatment behavior. You can call this multiple times, as
122+
* subsequent calls will be a no-op if the user is already enrolled.
123+
* - When enrolling, you can pass a list of 'metrics' that should be sent for the experiment. Each metric defines an
124+
* event, value count and conversion window. e.g. metric: 'search', value: 4, conversionWindow 1-7: triggered
125+
* once 4 searches have been done within 1-7 days (inclusive) of enrollment.
126+
* - `generateRetentionMetrics` can be used to create a default list of retention metrics (search and app_use).
127+
*
128+
* Example:
129+
* - Check if user has been assigned a cohort for the subfeature: `remoteConfig.getCohortName(feature, subFeature) !== null`
130+
* - Check if user is in the 'treatment' group: `remoteConfig.isSubFeatureEnabled(feature, subFeature, 'treatment')`
131+
* - Enroll the user in the experiment (with default retention metrics.): `abnMetrics.markExperimentEnrolled(feature, subFeature)`
132+
*/
113133
export default class AbnExperimentMetrics {
114134
/**
115135
*

0 commit comments

Comments
 (0)