@oursprivacy/platform-sdk 1.34.0 → 1.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -116,7 +116,9 @@ export class Experiments extends APIResource {
116
116
 
117
117
  /**
118
118
  * Stop an experiment. The request body is optional — send `{}` to stop without
119
- * recording a winner. Requires scope: experiment:stop
119
+ * recording a winner. Optionally pass `winnerVariantId` to record the winner
120
+ * (reporting only) and/or `rolloutVariantId` to keep that variant serving to all
121
+ * traffic. Requires scope: experiment:stop
120
122
  *
121
123
  * @example
122
124
  * ```ts
@@ -131,6 +133,62 @@ export class Experiments extends APIResource {
131
133
  return this._client.post(path`/rest/v1/experiments/${id}/stop`, { body, ...options });
132
134
  }
133
135
 
136
+ /**
137
+ * Roll a non-control variant out to 100% of targeted traffic on a completed
138
+ * experiment — the explicit, reversible serving decision that makes a winning
139
+ * experience the ongoing default. Publishes. Reverse with `/end-rollout`. Returns
140
+ * 409 if the experiment is not completed or the variant is the control. Requires
141
+ * scope: experiment:stop
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * const response = await client.experiments.rollout('id', {
146
+ * variantId: 'var_01HZX8YJH3Z3W1R2Q4M5N6P7Q8',
147
+ * });
148
+ * ```
149
+ */
150
+ rollout(
151
+ id: string,
152
+ body: ExperimentRolloutParams,
153
+ options?: RequestOptions,
154
+ ): APIPromise<ExperimentRolloutResponse> {
155
+ return this._client.post(path`/rest/v1/experiments/${id}/rollout`, { body, ...options });
156
+ }
157
+
158
+ /**
159
+ * End an active rollout: stop serving the rolled-out variant so every matching
160
+ * visitor reverts to the original experience. The declared winner is left intact.
161
+ * Publishes. Returns 409 if the experiment is not currently rolled out. Requires
162
+ * scope: experiment:stop
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * const response = await client.experiments.endRollout('id');
167
+ * ```
168
+ */
169
+ endRollout(id: string, options?: RequestOptions): APIPromise<ExperimentEndRolloutResponse> {
170
+ return this._client.post(path`/rest/v1/experiments/${id}/end-rollout`, options);
171
+ }
172
+
173
+ /**
174
+ * Declare, change, or clear the winning variant on a completed experiment.
175
+ * Reporting metadata only — it does not change what visitors see and does not
176
+ * republish. Omit `winnerVariantId` to clear. To make the winner live, use
177
+ * `/rollout`. Requires scope: experiment:stop
178
+ *
179
+ * @example
180
+ * ```ts
181
+ * const response = await client.experiments.winner('id');
182
+ * ```
183
+ */
184
+ winner(
185
+ id: string,
186
+ body: ExperimentWinnerParams | null | undefined = {},
187
+ options?: RequestOptions,
188
+ ): APIPromise<ExperimentWinnerResponse> {
189
+ return this._client.post(path`/rest/v1/experiments/${id}/winner`, { body, ...options });
190
+ }
191
+
134
192
  /**
135
193
  * Pause a running experiment. Stops new variant assignments while preserving
136
194
  * existing ones; the experiment can later be resumed. The request body is
@@ -288,6 +346,15 @@ export interface ExperimentListResponse {
288
346
  */
289
347
  metrics?: ExperimentListResponse.Metrics | null;
290
348
 
349
+ /**
350
+ * Variant currently rolled out to 100% of targeted traffic on a completed
351
+ * experiment. When set (and not the control), the runtime keeps serving it to
352
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
353
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
354
+ * cleared via `POST /experiments/{id}/end-rollout`.
355
+ */
356
+ rolloutVariantId?: string | null;
357
+
291
358
  /**
292
359
  * ISO-8601 timestamp when the experiment most recently entered a running state.
293
360
  */
@@ -317,8 +384,9 @@ export interface ExperimentListResponse {
317
384
  updatedAt?: string | null;
318
385
 
319
386
  /**
320
- * Variant ID persisted as the winner when the experiment was stopped. Set via
321
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
387
+ * Declared winning variant — reporting metadata only. Records which variant won;
388
+ * does NOT change what visitors are served. Set at stop time or later via
389
+ * `POST /experiments/{id}/winner`.
322
390
  */
323
391
  winnerVariantId?: string | null;
324
392
  }
@@ -482,6 +550,15 @@ export interface ExperimentCreateResponse {
482
550
  */
483
551
  metrics?: ExperimentCreateResponse.Metrics | null;
484
552
 
553
+ /**
554
+ * Variant currently rolled out to 100% of targeted traffic on a completed
555
+ * experiment. When set (and not the control), the runtime keeps serving it to
556
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
557
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
558
+ * cleared via `POST /experiments/{id}/end-rollout`.
559
+ */
560
+ rolloutVariantId?: string | null;
561
+
485
562
  /**
486
563
  * ISO-8601 timestamp when the experiment most recently entered a running state.
487
564
  */
@@ -511,8 +588,9 @@ export interface ExperimentCreateResponse {
511
588
  updatedAt?: string | null;
512
589
 
513
590
  /**
514
- * Variant ID persisted as the winner when the experiment was stopped. Set via
515
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
591
+ * Declared winning variant — reporting metadata only. Records which variant won;
592
+ * does NOT change what visitors are served. Set at stop time or later via
593
+ * `POST /experiments/{id}/winner`.
516
594
  */
517
595
  winnerVariantId?: string | null;
518
596
  }
@@ -784,6 +862,15 @@ export interface ExperimentRetrieveResponse {
784
862
  */
785
863
  metrics?: ExperimentRetrieveResponse.Metrics | null;
786
864
 
865
+ /**
866
+ * Variant currently rolled out to 100% of targeted traffic on a completed
867
+ * experiment. When set (and not the control), the runtime keeps serving it to
868
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
869
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
870
+ * cleared via `POST /experiments/{id}/end-rollout`.
871
+ */
872
+ rolloutVariantId?: string | null;
873
+
787
874
  /**
788
875
  * ISO-8601 timestamp when the experiment most recently entered a running state.
789
876
  */
@@ -813,8 +900,9 @@ export interface ExperimentRetrieveResponse {
813
900
  updatedAt?: string | null;
814
901
 
815
902
  /**
816
- * Variant ID persisted as the winner when the experiment was stopped. Set via
817
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
903
+ * Declared winning variant — reporting metadata only. Records which variant won;
904
+ * does NOT change what visitors are served. Set at stop time or later via
905
+ * `POST /experiments/{id}/winner`.
818
906
  */
819
907
  winnerVariantId?: string | null;
820
908
  }
@@ -1079,6 +1167,15 @@ export interface ExperimentUpdateResponse {
1079
1167
  */
1080
1168
  metrics?: ExperimentUpdateResponse.Metrics | null;
1081
1169
 
1170
+ /**
1171
+ * Variant currently rolled out to 100% of targeted traffic on a completed
1172
+ * experiment. When set (and not the control), the runtime keeps serving it to
1173
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
1174
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
1175
+ * cleared via `POST /experiments/{id}/end-rollout`.
1176
+ */
1177
+ rolloutVariantId?: string | null;
1178
+
1082
1179
  /**
1083
1180
  * ISO-8601 timestamp when the experiment most recently entered a running state.
1084
1181
  */
@@ -1108,8 +1205,9 @@ export interface ExperimentUpdateResponse {
1108
1205
  updatedAt?: string | null;
1109
1206
 
1110
1207
  /**
1111
- * Variant ID persisted as the winner when the experiment was stopped. Set via
1112
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
1208
+ * Declared winning variant — reporting metadata only. Records which variant won;
1209
+ * does NOT change what visitors are served. Set at stop time or later via
1210
+ * `POST /experiments/{id}/winner`.
1113
1211
  */
1114
1212
  winnerVariantId?: string | null;
1115
1213
  }
@@ -1289,6 +1387,15 @@ export namespace ExperimentStartResponse {
1289
1387
  */
1290
1388
  metrics?: Experiment.Metrics | null;
1291
1389
 
1390
+ /**
1391
+ * Variant currently rolled out to 100% of targeted traffic on a completed
1392
+ * experiment. When set (and not the control), the runtime keeps serving it to
1393
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
1394
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
1395
+ * cleared via `POST /experiments/{id}/end-rollout`.
1396
+ */
1397
+ rolloutVariantId?: string | null;
1398
+
1292
1399
  /**
1293
1400
  * ISO-8601 timestamp when the experiment most recently entered a running state.
1294
1401
  */
@@ -1318,8 +1425,9 @@ export namespace ExperimentStartResponse {
1318
1425
  updatedAt?: string | null;
1319
1426
 
1320
1427
  /**
1321
- * Variant ID persisted as the winner when the experiment was stopped. Set via
1322
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
1428
+ * Declared winning variant — reporting metadata only. Records which variant won;
1429
+ * does NOT change what visitors are served. Set at stop time or later via
1430
+ * `POST /experiments/{id}/winner`.
1323
1431
  */
1324
1432
  winnerVariantId?: string | null;
1325
1433
  }
@@ -1495,6 +1603,15 @@ export namespace ExperimentStopResponse {
1495
1603
  */
1496
1604
  metrics?: Experiment.Metrics | null;
1497
1605
 
1606
+ /**
1607
+ * Variant currently rolled out to 100% of targeted traffic on a completed
1608
+ * experiment. When set (and not the control), the runtime keeps serving it to
1609
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
1610
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
1611
+ * cleared via `POST /experiments/{id}/end-rollout`.
1612
+ */
1613
+ rolloutVariantId?: string | null;
1614
+
1498
1615
  /**
1499
1616
  * ISO-8601 timestamp when the experiment most recently entered a running state.
1500
1617
  */
@@ -1524,8 +1641,9 @@ export namespace ExperimentStopResponse {
1524
1641
  updatedAt?: string | null;
1525
1642
 
1526
1643
  /**
1527
- * Variant ID persisted as the winner when the experiment was stopped. Set via
1528
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
1644
+ * Declared winning variant — reporting metadata only. Records which variant won;
1645
+ * does NOT change what visitors are served. Set at stop time or later via
1646
+ * `POST /experiments/{id}/winner`.
1529
1647
  */
1530
1648
  winnerVariantId?: string | null;
1531
1649
  }
@@ -1630,7 +1748,7 @@ export namespace ExperimentStopResponse {
1630
1748
  }
1631
1749
  }
1632
1750
 
1633
- export interface ExperimentPauseResponse {
1751
+ export interface ExperimentRolloutResponse {
1634
1752
  /**
1635
1753
  * Number of unpublished version changes detected at the time of the lifecycle
1636
1754
  * action. Values greater than 1 mean other unpublished work exists besides this
@@ -1638,7 +1756,7 @@ export interface ExperimentPauseResponse {
1638
1756
  */
1639
1757
  concurrentVersionChanges: number;
1640
1758
 
1641
- experiment: ExperimentPauseResponse.Experiment;
1759
+ experiment: ExperimentRolloutResponse.Experiment;
1642
1760
 
1643
1761
  /**
1644
1762
  * Whether the status change was also published to the current live version
@@ -1647,7 +1765,7 @@ export interface ExperimentPauseResponse {
1647
1765
  publishStatus: 'pending_publish' | 'published';
1648
1766
  }
1649
1767
 
1650
- export namespace ExperimentPauseResponse {
1768
+ export namespace ExperimentRolloutResponse {
1651
1769
  export interface Experiment {
1652
1770
  /**
1653
1771
  * Unique identifier for the experiment.
@@ -1701,6 +1819,15 @@ export namespace ExperimentPauseResponse {
1701
1819
  */
1702
1820
  metrics?: Experiment.Metrics | null;
1703
1821
 
1822
+ /**
1823
+ * Variant currently rolled out to 100% of targeted traffic on a completed
1824
+ * experiment. When set (and not the control), the runtime keeps serving it to
1825
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
1826
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
1827
+ * cleared via `POST /experiments/{id}/end-rollout`.
1828
+ */
1829
+ rolloutVariantId?: string | null;
1830
+
1704
1831
  /**
1705
1832
  * ISO-8601 timestamp when the experiment most recently entered a running state.
1706
1833
  */
@@ -1730,8 +1857,9 @@ export namespace ExperimentPauseResponse {
1730
1857
  updatedAt?: string | null;
1731
1858
 
1732
1859
  /**
1733
- * Variant ID persisted as the winner when the experiment was stopped. Set via
1734
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
1860
+ * Declared winning variant — reporting metadata only. Records which variant won;
1861
+ * does NOT change what visitors are served. Set at stop time or later via
1862
+ * `POST /experiments/{id}/winner`.
1735
1863
  */
1736
1864
  winnerVariantId?: string | null;
1737
1865
  }
@@ -1836,7 +1964,7 @@ export namespace ExperimentPauseResponse {
1836
1964
  }
1837
1965
  }
1838
1966
 
1839
- export interface ExperimentResumeResponse {
1967
+ export interface ExperimentEndRolloutResponse {
1840
1968
  /**
1841
1969
  * Number of unpublished version changes detected at the time of the lifecycle
1842
1970
  * action. Values greater than 1 mean other unpublished work exists besides this
@@ -1844,7 +1972,7 @@ export interface ExperimentResumeResponse {
1844
1972
  */
1845
1973
  concurrentVersionChanges: number;
1846
1974
 
1847
- experiment: ExperimentResumeResponse.Experiment;
1975
+ experiment: ExperimentEndRolloutResponse.Experiment;
1848
1976
 
1849
1977
  /**
1850
1978
  * Whether the status change was also published to the current live version
@@ -1853,7 +1981,7 @@ export interface ExperimentResumeResponse {
1853
1981
  publishStatus: 'pending_publish' | 'published';
1854
1982
  }
1855
1983
 
1856
- export namespace ExperimentResumeResponse {
1984
+ export namespace ExperimentEndRolloutResponse {
1857
1985
  export interface Experiment {
1858
1986
  /**
1859
1987
  * Unique identifier for the experiment.
@@ -1907,6 +2035,15 @@ export namespace ExperimentResumeResponse {
1907
2035
  */
1908
2036
  metrics?: Experiment.Metrics | null;
1909
2037
 
2038
+ /**
2039
+ * Variant currently rolled out to 100% of targeted traffic on a completed
2040
+ * experiment. When set (and not the control), the runtime keeps serving it to
2041
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
2042
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
2043
+ * cleared via `POST /experiments/{id}/end-rollout`.
2044
+ */
2045
+ rolloutVariantId?: string | null;
2046
+
1910
2047
  /**
1911
2048
  * ISO-8601 timestamp when the experiment most recently entered a running state.
1912
2049
  */
@@ -1936,8 +2073,9 @@ export namespace ExperimentResumeResponse {
1936
2073
  updatedAt?: string | null;
1937
2074
 
1938
2075
  /**
1939
- * Variant ID persisted as the winner when the experiment was stopped. Set via
1940
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
2076
+ * Declared winning variant — reporting metadata only. Records which variant won;
2077
+ * does NOT change what visitors are served. Set at stop time or later via
2078
+ * `POST /experiments/{id}/winner`.
1941
2079
  */
1942
2080
  winnerVariantId?: string | null;
1943
2081
  }
@@ -2042,212 +2180,841 @@ export namespace ExperimentResumeResponse {
2042
2180
  }
2043
2181
  }
2044
2182
 
2045
- export interface ExperimentResultsResponse {
2183
+ export interface ExperimentWinnerResponse {
2046
2184
  /**
2047
- * Aggregate performance metrics for each variant in the experiment over the
2048
- * experiment runtime window.
2185
+ * Unique identifier for the experiment.
2049
2186
  */
2050
- variants: Array<ExperimentResultsResponse.Variant>;
2051
- }
2052
-
2053
- export namespace ExperimentResultsResponse {
2054
- export interface Variant {
2055
- /**
2056
- * Variant ID this result row belongs to.
2057
- */
2058
- id: string;
2059
-
2060
- /**
2061
- * Conversions divided by impressions for this variant.
2062
- */
2063
- conversionRate: number;
2064
-
2065
- /**
2066
- * Number of post-exposure conversions attributed to the variant.
2067
- */
2068
- conversions: number;
2069
-
2070
- /**
2071
- * Number of distinct experiment-impression events counted for the variant.
2072
- */
2073
- impressions: number;
2074
-
2075
- /**
2076
- * Whether this variant is the experiment control. Exactly one variant per
2077
- * experiment is the control.
2078
- */
2079
- isControl: boolean;
2080
-
2081
- /**
2082
- * Human-readable variant name as configured on the experiment (e.g. `Control`,
2083
- * `Treatment`). Lets callers label results without a separate lookup against
2084
- * `/experiment-variants`.
2085
- */
2086
- name: string;
2087
-
2088
- /**
2089
- * Bayesian probability that this variant is the best-performing option among all
2090
- * variants in the experiment.
2091
- */
2092
- probabilityToBeBest: number;
2093
- }
2094
- }
2187
+ id: string;
2095
2188
 
2096
- export interface ExperimentResultsTimeSeriesResponse {
2097
2189
  /**
2098
- * Per-day metrics for each variant. Days with no impression rows are omitted from
2099
- * the response.
2190
+ * ISO-8601 timestamp when the experiment was created.
2100
2191
  */
2101
- days: Array<ExperimentResultsTimeSeriesResponse.Day>;
2102
- }
2103
-
2104
- export namespace ExperimentResultsTimeSeriesResponse {
2105
- export interface Day {
2106
- /**
2107
- * UTC calendar day in `YYYY-MM-DD` format.
2108
- */
2109
- date: string;
2110
-
2111
- variants: Array<Day.Variant>;
2112
- }
2113
-
2114
- export namespace Day {
2115
- export interface Variant {
2116
- id: string;
2117
-
2118
- conversionRate: number;
2119
-
2120
- conversions: number;
2121
-
2122
- impressions: number;
2123
- }
2124
- }
2125
- }
2192
+ createdAt: string;
2126
2193
 
2127
- export interface ExperimentSessionReplaysResponse {
2128
2194
  /**
2129
- * Sessions in which a `$experiment_impression` event for this experiment was
2130
- * recorded, ordered newest first by session start time.
2195
+ * Stable code-facing key for the experiment. Use this with the headless SDK
2196
+ * `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
2197
+ * application code.
2131
2198
  */
2132
- entities: Array<ExperimentSessionReplaysResponse.Entity>;
2133
-
2134
- pagination: ExperimentSessionReplaysResponse.Pagination;
2135
- }
2136
-
2137
- export namespace ExperimentSessionReplaysResponse {
2138
- export interface Entity {
2139
- /**
2140
- * Time between the first and last events recorded for this session, in whole
2141
- * seconds.
2142
- */
2143
- durationSeconds: number;
2144
-
2145
- /**
2146
- * Number of distinct page paths visited during this session.
2147
- */
2148
- pageCount: number;
2149
-
2150
- /**
2151
- * Deep link to the in-app replay viewer for this session. Requires an
2152
- * authenticated session in the Ours Privacy app for an account that owns this
2153
- * experiment — not embeddable in customer-facing emails.
2154
- */
2155
- replayUrl: string;
2156
-
2157
- /**
2158
- * Session identifier (`dp_sid`). Combine with `visitorId` and the `YYYY-MM-DD`
2159
- * date of `startTime` to deep-link to a replay outside of the response
2160
- * `replayUrl`.
2161
- */
2162
- sessionId: string;
2163
-
2164
- /**
2165
- * ISO-8601 timestamp of the first event recorded in this session. Sessions are
2166
- * ordered newest first by this field.
2167
- */
2168
- startTime: string;
2169
-
2170
- /**
2171
- * Human-readable name of the variant the visitor was assigned for the recorded
2172
- * impression. May be empty if the variant has been deleted since the impression
2173
- * fired.
2174
- */
2175
- variantName: string;
2176
-
2177
- /**
2178
- * Visitor identifier whose session is recorded here.
2179
- */
2180
- visitorId: string;
2181
- }
2182
-
2183
- export interface Pagination {
2184
- hasMore: boolean;
2185
-
2186
- nextCursor?: string | null;
2187
- }
2188
- }
2199
+ key: string;
2189
2200
 
2190
- export interface ExperimentListParams extends CursorParams {
2191
2201
  /**
2192
- * Optional case-insensitive text search matched against experiment ID, name, and
2193
- * description.
2202
+ * Short, human-readable experiment name.
2194
2203
  */
2195
- search?: string;
2204
+ name: string;
2196
2205
 
2197
2206
  /**
2198
- * Optional lifecycle-state filter.
2207
+ * Lifecycle state. `draft` is editable, `running` is active, `paused` is
2208
+ * temporarily inactive, and `completed` is permanently stopped.
2199
2209
  */
2200
- status?: 'completed' | 'draft' | 'paused' | 'running';
2210
+ status: 'completed' | 'draft' | 'paused' | 'running';
2201
2211
 
2202
2212
  /**
2203
- * Optional experiment-type filter.
2213
+ * Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
2214
+ * enrollment without deleting the experiment.
2204
2215
  */
2205
- type?: 'ab' | 'multivariate' | 'personalization';
2206
- }
2216
+ trafficAllocation: number;
2207
2217
 
2208
- export interface ExperimentCreateParams {
2209
2218
  /**
2210
- * ID of the experiment settings record that owns this experiment. Call
2211
- * `GET /rest/v1/experiment-settings` first if you need to discover the correct ID
2212
- * for the current account.
2219
+ * Optional human-readable hypothesis or summary. In GraphQL this is backed by the
2220
+ * experiment hypothesis field.
2213
2221
  */
2214
- experimentSettingsId: string;
2222
+ description?: string | null;
2215
2223
 
2216
2224
  /**
2217
- * Short experiment name.
2225
+ * For redirect variants, whether the original page query string should be
2226
+ * forwarded onto the redirect URL.
2218
2227
  */
2219
- name: string;
2228
+ includeQueryString?: boolean | null;
2220
2229
 
2221
2230
  /**
2222
- * Weight of the auto-created control variant, as a percentage (1–100). Defaults to
2223
- * 100 (a new experiment is all control until treatments are added). The control
2224
- * must keep at least 1% — a 0% control leaves visitors with no bucket to assign at
2225
- * runtime. As treatments are added the control is reconciled to the remainder (100
2226
- * − Σ treatment weights), so it normally does not need to be set explicitly.
2231
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
2232
+ * from a GET response can be PATCHed back without modification.
2227
2233
  */
2228
- controlWeight?: number | null;
2234
+ metrics?: ExperimentWinnerResponse.Metrics | null;
2229
2235
 
2230
2236
  /**
2231
- * Optional hypothesis or operator note.
2237
+ * Variant currently rolled out to 100% of targeted traffic on a completed
2238
+ * experiment. When set (and not the control), the runtime keeps serving it to
2239
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
2240
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
2241
+ * cleared via `POST /experiments/{id}/end-rollout`.
2232
2242
  */
2233
- description?: string | null;
2243
+ rolloutVariantId?: string | null;
2234
2244
 
2235
2245
  /**
2236
- * Whether redirect variants in this experiment should preserve the original
2237
- * request query string.
2246
+ * ISO-8601 timestamp when the experiment most recently entered a running state.
2238
2247
  */
2239
- includeQueryString?: boolean | null;
2248
+ startedAt?: string | null;
2240
2249
 
2241
2250
  /**
2242
- * Optional stable code-facing key. When omitted, the API slugifies the name
2243
- * automatically.
2251
+ * ISO-8601 timestamp when the experiment was completed, if it has been stopped.
2244
2252
  */
2245
- key?: string | null;
2253
+ stoppedAt?: string | null;
2246
2254
 
2247
2255
  /**
2248
- * Goal events. If you send `metrics.primary`, `metrics.primary.eventName` must be
2249
- * a non-blank string. A primary event name is required before the experiment can
2250
- * be started.
2256
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
2257
+ * visitor status, and (server-side) visitor properties. Same shape as the
2258
+ * create/patch input.
2259
+ */
2260
+ targetingRules?: ExperimentWinnerResponse.TargetingRules | null;
2261
+
2262
+ /**
2263
+ * Experiment mode. `ab` and `multivariate` use traffic allocation and results;
2264
+ * `personalization` is always-on targeting.
2265
+ */
2266
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
2267
+
2268
+ /**
2269
+ * ISO-8601 timestamp for the last persisted update, if any.
2270
+ */
2271
+ updatedAt?: string | null;
2272
+
2273
+ /**
2274
+ * Declared winning variant — reporting metadata only. Records which variant won;
2275
+ * does NOT change what visitors are served. Set at stop time or later via
2276
+ * `POST /experiments/{id}/winner`.
2277
+ */
2278
+ winnerVariantId?: string | null;
2279
+ }
2280
+
2281
+ export namespace ExperimentWinnerResponse {
2282
+ /**
2283
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
2284
+ * from a GET response can be PATCHed back without modification.
2285
+ */
2286
+ export interface Metrics {
2287
+ /**
2288
+ * Primary success metric used in the results report.
2289
+ */
2290
+ primary?: unknown | null;
2291
+
2292
+ /**
2293
+ * Optional secondary metrics tracked alongside the primary goal.
2294
+ */
2295
+ secondary?: Array<Metrics.Secondary> | null;
2296
+ }
2297
+
2298
+ export namespace Metrics {
2299
+ export interface Secondary {
2300
+ /**
2301
+ * Name of the event used to measure success for this metric.
2302
+ */
2303
+ eventName?: string | null;
2304
+
2305
+ /**
2306
+ * Optional funnel identifier when the metric is derived from an existing funnel
2307
+ * definition.
2308
+ */
2309
+ funnelId?: string | null;
2310
+ }
2311
+ }
2312
+
2313
+ /**
2314
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
2315
+ * visitor status, and (server-side) visitor properties. Same shape as the
2316
+ * create/patch input.
2317
+ */
2318
+ export interface TargetingRules {
2319
+ /**
2320
+ * Glob-style URL patterns that must match for the experiment to be eligible. Each
2321
+ * pattern is either a path (`/pricing`, matched on any domain) or a host-qualified
2322
+ * pattern (`get.example.com/pricing` or `https://get.example.com/pricing`, matched
2323
+ * against the full URL so a single domain or subdomain can be targeted). Use `*`
2324
+ * to match within a path segment and `**` to match across segments. Up to 200
2325
+ * patterns; each pattern up to 2000 characters. An empty array (or omitting the
2326
+ * field) matches all URLs — equivalent to `['**']`. The host(s) targeted here must
2327
+ * also appear in the parent experiment settings' `whitelistDomains` — that
2328
+ * allowlist is what limits which domains can load your experiments (see
2329
+ * `GET /experiment-settings`). If the host is missing, the SDK refuses to load
2330
+ * there and the experiment never runs, even after `POST /experiments/{id}/start`
2331
+ * succeeds.
2332
+ */
2333
+ urlPatterns: Array<string>;
2334
+
2335
+ /**
2336
+ * Optional audience identifier used for server-side eligibility filtering.
2337
+ */
2338
+ audienceId?: string | null;
2339
+
2340
+ /**
2341
+ * Additional query-string conditions that must all match for the visitor to
2342
+ * qualify.
2343
+ */
2344
+ queryParams?: Array<TargetingRules.QueryParam> | null;
2345
+
2346
+ /**
2347
+ * Optional visitor-property matching rules. These are passed through as JSON for
2348
+ * experimentation targeting.
2349
+ */
2350
+ visitorProperties?: unknown | null;
2351
+
2352
+ /**
2353
+ * Whether the experiment should target new visitors, returning visitors, or any
2354
+ * visitor.
2355
+ */
2356
+ visitorStatus?: string | null;
2357
+ }
2358
+
2359
+ export namespace TargetingRules {
2360
+ export interface QueryParam {
2361
+ /**
2362
+ * Query string key to inspect on the current page URL.
2363
+ */
2364
+ key: string;
2365
+
2366
+ /**
2367
+ * Comparison operator applied to the query string value.
2368
+ */
2369
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists' | 'regex';
2370
+
2371
+ /**
2372
+ * Comparison value used by operators that require one. Omit for `exists` and
2373
+ * `not_exists`.
2374
+ */
2375
+ value?: string | null;
2376
+ }
2377
+ }
2378
+ }
2379
+
2380
+ export interface ExperimentPauseResponse {
2381
+ /**
2382
+ * Number of unpublished version changes detected at the time of the lifecycle
2383
+ * action. Values greater than 1 mean other unpublished work exists besides this
2384
+ * experiment state change.
2385
+ */
2386
+ concurrentVersionChanges: number;
2387
+
2388
+ experiment: ExperimentPauseResponse.Experiment;
2389
+
2390
+ /**
2391
+ * Whether the status change was also published to the current live version
2392
+ * immediately.
2393
+ */
2394
+ publishStatus: 'pending_publish' | 'published';
2395
+ }
2396
+
2397
+ export namespace ExperimentPauseResponse {
2398
+ export interface Experiment {
2399
+ /**
2400
+ * Unique identifier for the experiment.
2401
+ */
2402
+ id: string;
2403
+
2404
+ /**
2405
+ * ISO-8601 timestamp when the experiment was created.
2406
+ */
2407
+ createdAt: string;
2408
+
2409
+ /**
2410
+ * Stable code-facing key for the experiment. Use this with the headless SDK
2411
+ * `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
2412
+ * application code.
2413
+ */
2414
+ key: string;
2415
+
2416
+ /**
2417
+ * Short, human-readable experiment name.
2418
+ */
2419
+ name: string;
2420
+
2421
+ /**
2422
+ * Lifecycle state. `draft` is editable, `running` is active, `paused` is
2423
+ * temporarily inactive, and `completed` is permanently stopped.
2424
+ */
2425
+ status: 'completed' | 'draft' | 'paused' | 'running';
2426
+
2427
+ /**
2428
+ * Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
2429
+ * enrollment without deleting the experiment.
2430
+ */
2431
+ trafficAllocation: number;
2432
+
2433
+ /**
2434
+ * Optional human-readable hypothesis or summary. In GraphQL this is backed by the
2435
+ * experiment hypothesis field.
2436
+ */
2437
+ description?: string | null;
2438
+
2439
+ /**
2440
+ * For redirect variants, whether the original page query string should be
2441
+ * forwarded onto the redirect URL.
2442
+ */
2443
+ includeQueryString?: boolean | null;
2444
+
2445
+ /**
2446
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
2447
+ * from a GET response can be PATCHed back without modification.
2448
+ */
2449
+ metrics?: Experiment.Metrics | null;
2450
+
2451
+ /**
2452
+ * Variant currently rolled out to 100% of targeted traffic on a completed
2453
+ * experiment. When set (and not the control), the runtime keeps serving it to
2454
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
2455
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
2456
+ * cleared via `POST /experiments/{id}/end-rollout`.
2457
+ */
2458
+ rolloutVariantId?: string | null;
2459
+
2460
+ /**
2461
+ * ISO-8601 timestamp when the experiment most recently entered a running state.
2462
+ */
2463
+ startedAt?: string | null;
2464
+
2465
+ /**
2466
+ * ISO-8601 timestamp when the experiment was completed, if it has been stopped.
2467
+ */
2468
+ stoppedAt?: string | null;
2469
+
2470
+ /**
2471
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
2472
+ * visitor status, and (server-side) visitor properties. Same shape as the
2473
+ * create/patch input.
2474
+ */
2475
+ targetingRules?: Experiment.TargetingRules | null;
2476
+
2477
+ /**
2478
+ * Experiment mode. `ab` and `multivariate` use traffic allocation and results;
2479
+ * `personalization` is always-on targeting.
2480
+ */
2481
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
2482
+
2483
+ /**
2484
+ * ISO-8601 timestamp for the last persisted update, if any.
2485
+ */
2486
+ updatedAt?: string | null;
2487
+
2488
+ /**
2489
+ * Declared winning variant — reporting metadata only. Records which variant won;
2490
+ * does NOT change what visitors are served. Set at stop time or later via
2491
+ * `POST /experiments/{id}/winner`.
2492
+ */
2493
+ winnerVariantId?: string | null;
2494
+ }
2495
+
2496
+ export namespace Experiment {
2497
+ /**
2498
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
2499
+ * from a GET response can be PATCHed back without modification.
2500
+ */
2501
+ export interface Metrics {
2502
+ /**
2503
+ * Primary success metric used in the results report.
2504
+ */
2505
+ primary?: unknown | null;
2506
+
2507
+ /**
2508
+ * Optional secondary metrics tracked alongside the primary goal.
2509
+ */
2510
+ secondary?: Array<Metrics.Secondary> | null;
2511
+ }
2512
+
2513
+ export namespace Metrics {
2514
+ export interface Secondary {
2515
+ /**
2516
+ * Name of the event used to measure success for this metric.
2517
+ */
2518
+ eventName?: string | null;
2519
+
2520
+ /**
2521
+ * Optional funnel identifier when the metric is derived from an existing funnel
2522
+ * definition.
2523
+ */
2524
+ funnelId?: string | null;
2525
+ }
2526
+ }
2527
+
2528
+ /**
2529
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
2530
+ * visitor status, and (server-side) visitor properties. Same shape as the
2531
+ * create/patch input.
2532
+ */
2533
+ export interface TargetingRules {
2534
+ /**
2535
+ * Glob-style URL patterns that must match for the experiment to be eligible. Each
2536
+ * pattern is either a path (`/pricing`, matched on any domain) or a host-qualified
2537
+ * pattern (`get.example.com/pricing` or `https://get.example.com/pricing`, matched
2538
+ * against the full URL so a single domain or subdomain can be targeted). Use `*`
2539
+ * to match within a path segment and `**` to match across segments. Up to 200
2540
+ * patterns; each pattern up to 2000 characters. An empty array (or omitting the
2541
+ * field) matches all URLs — equivalent to `['**']`. The host(s) targeted here must
2542
+ * also appear in the parent experiment settings' `whitelistDomains` — that
2543
+ * allowlist is what limits which domains can load your experiments (see
2544
+ * `GET /experiment-settings`). If the host is missing, the SDK refuses to load
2545
+ * there and the experiment never runs, even after `POST /experiments/{id}/start`
2546
+ * succeeds.
2547
+ */
2548
+ urlPatterns: Array<string>;
2549
+
2550
+ /**
2551
+ * Optional audience identifier used for server-side eligibility filtering.
2552
+ */
2553
+ audienceId?: string | null;
2554
+
2555
+ /**
2556
+ * Additional query-string conditions that must all match for the visitor to
2557
+ * qualify.
2558
+ */
2559
+ queryParams?: Array<TargetingRules.QueryParam> | null;
2560
+
2561
+ /**
2562
+ * Optional visitor-property matching rules. These are passed through as JSON for
2563
+ * experimentation targeting.
2564
+ */
2565
+ visitorProperties?: unknown | null;
2566
+
2567
+ /**
2568
+ * Whether the experiment should target new visitors, returning visitors, or any
2569
+ * visitor.
2570
+ */
2571
+ visitorStatus?: string | null;
2572
+ }
2573
+
2574
+ export namespace TargetingRules {
2575
+ export interface QueryParam {
2576
+ /**
2577
+ * Query string key to inspect on the current page URL.
2578
+ */
2579
+ key: string;
2580
+
2581
+ /**
2582
+ * Comparison operator applied to the query string value.
2583
+ */
2584
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists' | 'regex';
2585
+
2586
+ /**
2587
+ * Comparison value used by operators that require one. Omit for `exists` and
2588
+ * `not_exists`.
2589
+ */
2590
+ value?: string | null;
2591
+ }
2592
+ }
2593
+ }
2594
+ }
2595
+
2596
+ export interface ExperimentResumeResponse {
2597
+ /**
2598
+ * Number of unpublished version changes detected at the time of the lifecycle
2599
+ * action. Values greater than 1 mean other unpublished work exists besides this
2600
+ * experiment state change.
2601
+ */
2602
+ concurrentVersionChanges: number;
2603
+
2604
+ experiment: ExperimentResumeResponse.Experiment;
2605
+
2606
+ /**
2607
+ * Whether the status change was also published to the current live version
2608
+ * immediately.
2609
+ */
2610
+ publishStatus: 'pending_publish' | 'published';
2611
+ }
2612
+
2613
+ export namespace ExperimentResumeResponse {
2614
+ export interface Experiment {
2615
+ /**
2616
+ * Unique identifier for the experiment.
2617
+ */
2618
+ id: string;
2619
+
2620
+ /**
2621
+ * ISO-8601 timestamp when the experiment was created.
2622
+ */
2623
+ createdAt: string;
2624
+
2625
+ /**
2626
+ * Stable code-facing key for the experiment. Use this with the headless SDK
2627
+ * `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
2628
+ * application code.
2629
+ */
2630
+ key: string;
2631
+
2632
+ /**
2633
+ * Short, human-readable experiment name.
2634
+ */
2635
+ name: string;
2636
+
2637
+ /**
2638
+ * Lifecycle state. `draft` is editable, `running` is active, `paused` is
2639
+ * temporarily inactive, and `completed` is permanently stopped.
2640
+ */
2641
+ status: 'completed' | 'draft' | 'paused' | 'running';
2642
+
2643
+ /**
2644
+ * Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
2645
+ * enrollment without deleting the experiment.
2646
+ */
2647
+ trafficAllocation: number;
2648
+
2649
+ /**
2650
+ * Optional human-readable hypothesis or summary. In GraphQL this is backed by the
2651
+ * experiment hypothesis field.
2652
+ */
2653
+ description?: string | null;
2654
+
2655
+ /**
2656
+ * For redirect variants, whether the original page query string should be
2657
+ * forwarded onto the redirect URL.
2658
+ */
2659
+ includeQueryString?: boolean | null;
2660
+
2661
+ /**
2662
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
2663
+ * from a GET response can be PATCHed back without modification.
2664
+ */
2665
+ metrics?: Experiment.Metrics | null;
2666
+
2667
+ /**
2668
+ * Variant currently rolled out to 100% of targeted traffic on a completed
2669
+ * experiment. When set (and not the control), the runtime keeps serving it to
2670
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
2671
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
2672
+ * cleared via `POST /experiments/{id}/end-rollout`.
2673
+ */
2674
+ rolloutVariantId?: string | null;
2675
+
2676
+ /**
2677
+ * ISO-8601 timestamp when the experiment most recently entered a running state.
2678
+ */
2679
+ startedAt?: string | null;
2680
+
2681
+ /**
2682
+ * ISO-8601 timestamp when the experiment was completed, if it has been stopped.
2683
+ */
2684
+ stoppedAt?: string | null;
2685
+
2686
+ /**
2687
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
2688
+ * visitor status, and (server-side) visitor properties. Same shape as the
2689
+ * create/patch input.
2690
+ */
2691
+ targetingRules?: Experiment.TargetingRules | null;
2692
+
2693
+ /**
2694
+ * Experiment mode. `ab` and `multivariate` use traffic allocation and results;
2695
+ * `personalization` is always-on targeting.
2696
+ */
2697
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
2698
+
2699
+ /**
2700
+ * ISO-8601 timestamp for the last persisted update, if any.
2701
+ */
2702
+ updatedAt?: string | null;
2703
+
2704
+ /**
2705
+ * Declared winning variant — reporting metadata only. Records which variant won;
2706
+ * does NOT change what visitors are served. Set at stop time or later via
2707
+ * `POST /experiments/{id}/winner`.
2708
+ */
2709
+ winnerVariantId?: string | null;
2710
+ }
2711
+
2712
+ export namespace Experiment {
2713
+ /**
2714
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
2715
+ * from a GET response can be PATCHed back without modification.
2716
+ */
2717
+ export interface Metrics {
2718
+ /**
2719
+ * Primary success metric used in the results report.
2720
+ */
2721
+ primary?: unknown | null;
2722
+
2723
+ /**
2724
+ * Optional secondary metrics tracked alongside the primary goal.
2725
+ */
2726
+ secondary?: Array<Metrics.Secondary> | null;
2727
+ }
2728
+
2729
+ export namespace Metrics {
2730
+ export interface Secondary {
2731
+ /**
2732
+ * Name of the event used to measure success for this metric.
2733
+ */
2734
+ eventName?: string | null;
2735
+
2736
+ /**
2737
+ * Optional funnel identifier when the metric is derived from an existing funnel
2738
+ * definition.
2739
+ */
2740
+ funnelId?: string | null;
2741
+ }
2742
+ }
2743
+
2744
+ /**
2745
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
2746
+ * visitor status, and (server-side) visitor properties. Same shape as the
2747
+ * create/patch input.
2748
+ */
2749
+ export interface TargetingRules {
2750
+ /**
2751
+ * Glob-style URL patterns that must match for the experiment to be eligible. Each
2752
+ * pattern is either a path (`/pricing`, matched on any domain) or a host-qualified
2753
+ * pattern (`get.example.com/pricing` or `https://get.example.com/pricing`, matched
2754
+ * against the full URL so a single domain or subdomain can be targeted). Use `*`
2755
+ * to match within a path segment and `**` to match across segments. Up to 200
2756
+ * patterns; each pattern up to 2000 characters. An empty array (or omitting the
2757
+ * field) matches all URLs — equivalent to `['**']`. The host(s) targeted here must
2758
+ * also appear in the parent experiment settings' `whitelistDomains` — that
2759
+ * allowlist is what limits which domains can load your experiments (see
2760
+ * `GET /experiment-settings`). If the host is missing, the SDK refuses to load
2761
+ * there and the experiment never runs, even after `POST /experiments/{id}/start`
2762
+ * succeeds.
2763
+ */
2764
+ urlPatterns: Array<string>;
2765
+
2766
+ /**
2767
+ * Optional audience identifier used for server-side eligibility filtering.
2768
+ */
2769
+ audienceId?: string | null;
2770
+
2771
+ /**
2772
+ * Additional query-string conditions that must all match for the visitor to
2773
+ * qualify.
2774
+ */
2775
+ queryParams?: Array<TargetingRules.QueryParam> | null;
2776
+
2777
+ /**
2778
+ * Optional visitor-property matching rules. These are passed through as JSON for
2779
+ * experimentation targeting.
2780
+ */
2781
+ visitorProperties?: unknown | null;
2782
+
2783
+ /**
2784
+ * Whether the experiment should target new visitors, returning visitors, or any
2785
+ * visitor.
2786
+ */
2787
+ visitorStatus?: string | null;
2788
+ }
2789
+
2790
+ export namespace TargetingRules {
2791
+ export interface QueryParam {
2792
+ /**
2793
+ * Query string key to inspect on the current page URL.
2794
+ */
2795
+ key: string;
2796
+
2797
+ /**
2798
+ * Comparison operator applied to the query string value.
2799
+ */
2800
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists' | 'regex';
2801
+
2802
+ /**
2803
+ * Comparison value used by operators that require one. Omit for `exists` and
2804
+ * `not_exists`.
2805
+ */
2806
+ value?: string | null;
2807
+ }
2808
+ }
2809
+ }
2810
+ }
2811
+
2812
+ export interface ExperimentResultsResponse {
2813
+ /**
2814
+ * Aggregate performance metrics for each variant in the experiment over the
2815
+ * experiment runtime window.
2816
+ */
2817
+ variants: Array<ExperimentResultsResponse.Variant>;
2818
+ }
2819
+
2820
+ export namespace ExperimentResultsResponse {
2821
+ export interface Variant {
2822
+ /**
2823
+ * Variant ID this result row belongs to.
2824
+ */
2825
+ id: string;
2826
+
2827
+ /**
2828
+ * Conversions divided by impressions for this variant.
2829
+ */
2830
+ conversionRate: number;
2831
+
2832
+ /**
2833
+ * Number of post-exposure conversions attributed to the variant.
2834
+ */
2835
+ conversions: number;
2836
+
2837
+ /**
2838
+ * Number of distinct experiment-impression events counted for the variant.
2839
+ */
2840
+ impressions: number;
2841
+
2842
+ /**
2843
+ * Whether this variant is the experiment control. Exactly one variant per
2844
+ * experiment is the control.
2845
+ */
2846
+ isControl: boolean;
2847
+
2848
+ /**
2849
+ * Human-readable variant name as configured on the experiment (e.g. `Control`,
2850
+ * `Treatment`). Lets callers label results without a separate lookup against
2851
+ * `/experiment-variants`.
2852
+ */
2853
+ name: string;
2854
+
2855
+ /**
2856
+ * Bayesian probability that this variant is the best-performing option among all
2857
+ * variants in the experiment.
2858
+ */
2859
+ probabilityToBeBest: number;
2860
+ }
2861
+ }
2862
+
2863
+ export interface ExperimentResultsTimeSeriesResponse {
2864
+ /**
2865
+ * Per-day metrics for each variant. Days with no impression rows are omitted from
2866
+ * the response.
2867
+ */
2868
+ days: Array<ExperimentResultsTimeSeriesResponse.Day>;
2869
+ }
2870
+
2871
+ export namespace ExperimentResultsTimeSeriesResponse {
2872
+ export interface Day {
2873
+ /**
2874
+ * UTC calendar day in `YYYY-MM-DD` format.
2875
+ */
2876
+ date: string;
2877
+
2878
+ variants: Array<Day.Variant>;
2879
+ }
2880
+
2881
+ export namespace Day {
2882
+ export interface Variant {
2883
+ id: string;
2884
+
2885
+ conversionRate: number;
2886
+
2887
+ conversions: number;
2888
+
2889
+ impressions: number;
2890
+ }
2891
+ }
2892
+ }
2893
+
2894
+ export interface ExperimentSessionReplaysResponse {
2895
+ /**
2896
+ * Sessions in which a `$experiment_impression` event for this experiment was
2897
+ * recorded, ordered newest first by session start time.
2898
+ */
2899
+ entities: Array<ExperimentSessionReplaysResponse.Entity>;
2900
+
2901
+ pagination: ExperimentSessionReplaysResponse.Pagination;
2902
+ }
2903
+
2904
+ export namespace ExperimentSessionReplaysResponse {
2905
+ export interface Entity {
2906
+ /**
2907
+ * Time between the first and last events recorded for this session, in whole
2908
+ * seconds.
2909
+ */
2910
+ durationSeconds: number;
2911
+
2912
+ /**
2913
+ * Number of distinct page paths visited during this session.
2914
+ */
2915
+ pageCount: number;
2916
+
2917
+ /**
2918
+ * Deep link to the in-app replay viewer for this session. Requires an
2919
+ * authenticated session in the Ours Privacy app for an account that owns this
2920
+ * experiment — not embeddable in customer-facing emails.
2921
+ */
2922
+ replayUrl: string;
2923
+
2924
+ /**
2925
+ * Session identifier (`dp_sid`). Combine with `visitorId` and the `YYYY-MM-DD`
2926
+ * date of `startTime` to deep-link to a replay outside of the response
2927
+ * `replayUrl`.
2928
+ */
2929
+ sessionId: string;
2930
+
2931
+ /**
2932
+ * ISO-8601 timestamp of the first event recorded in this session. Sessions are
2933
+ * ordered newest first by this field.
2934
+ */
2935
+ startTime: string;
2936
+
2937
+ /**
2938
+ * Human-readable name of the variant the visitor was assigned for the recorded
2939
+ * impression. May be empty if the variant has been deleted since the impression
2940
+ * fired.
2941
+ */
2942
+ variantName: string;
2943
+
2944
+ /**
2945
+ * Visitor identifier whose session is recorded here.
2946
+ */
2947
+ visitorId: string;
2948
+ }
2949
+
2950
+ export interface Pagination {
2951
+ hasMore: boolean;
2952
+
2953
+ nextCursor?: string | null;
2954
+ }
2955
+ }
2956
+
2957
+ export interface ExperimentListParams extends CursorParams {
2958
+ /**
2959
+ * Optional case-insensitive text search matched against experiment ID, name, and
2960
+ * description.
2961
+ */
2962
+ search?: string;
2963
+
2964
+ /**
2965
+ * Optional lifecycle-state filter.
2966
+ */
2967
+ status?: 'completed' | 'draft' | 'paused' | 'running';
2968
+
2969
+ /**
2970
+ * Optional experiment-type filter.
2971
+ */
2972
+ type?: 'ab' | 'multivariate' | 'personalization';
2973
+ }
2974
+
2975
+ export interface ExperimentCreateParams {
2976
+ /**
2977
+ * ID of the experiment settings record that owns this experiment. Call
2978
+ * `GET /rest/v1/experiment-settings` first if you need to discover the correct ID
2979
+ * for the current account.
2980
+ */
2981
+ experimentSettingsId: string;
2982
+
2983
+ /**
2984
+ * Short experiment name.
2985
+ */
2986
+ name: string;
2987
+
2988
+ /**
2989
+ * Weight of the auto-created control variant, as a percentage (1–100). Defaults to
2990
+ * 100 (a new experiment is all control until treatments are added). The control
2991
+ * must keep at least 1% — a 0% control leaves visitors with no bucket to assign at
2992
+ * runtime. As treatments are added the control is reconciled to the remainder (100
2993
+ * − Σ treatment weights), so it normally does not need to be set explicitly.
2994
+ */
2995
+ controlWeight?: number | null;
2996
+
2997
+ /**
2998
+ * Optional hypothesis or operator note.
2999
+ */
3000
+ description?: string | null;
3001
+
3002
+ /**
3003
+ * Whether redirect variants in this experiment should preserve the original
3004
+ * request query string.
3005
+ */
3006
+ includeQueryString?: boolean | null;
3007
+
3008
+ /**
3009
+ * Optional stable code-facing key. When omitted, the API slugifies the name
3010
+ * automatically.
3011
+ */
3012
+ key?: string | null;
3013
+
3014
+ /**
3015
+ * Goal events. If you send `metrics.primary`, `metrics.primary.eventName` must be
3016
+ * a non-blank string. A primary event name is required before the experiment can
3017
+ * be started.
2251
3018
  */
2252
3019
  metrics?: ExperimentCreateParams.Metrics | null;
2253
3020
 
@@ -2556,7 +3323,35 @@ export interface ExperimentStartParams {
2556
3323
 
2557
3324
  export interface ExperimentStopParams {
2558
3325
  /**
2559
- * Optional winning variant ID to persist when completing the experiment.
3326
+ * Optional variant to roll out to 100% of traffic immediately on stop — the
3327
+ * explicit serving decision that keeps the winning experience live (a winning
3328
+ * redirect becomes an ongoing redirect). Must be a non-control variant. Reverse
3329
+ * later via `POST /experiments/{id}/end-rollout`.
3330
+ */
3331
+ rolloutVariantId?: string;
3332
+
3333
+ /**
3334
+ * Optional declared winner to record (reporting metadata only — does not change
3335
+ * what visitors are served).
3336
+ */
3337
+ winnerVariantId?: string;
3338
+ }
3339
+
3340
+ export interface ExperimentRolloutParams {
3341
+ /**
3342
+ * Non-control variant to roll out to 100% of targeted traffic. The runtime keeps
3343
+ * serving it to every matching visitor — a winning redirect becomes an ongoing
3344
+ * redirect. Reverse via `POST /experiments/{id}/end-rollout`. The experiment must
3345
+ * be completed.
3346
+ */
3347
+ variantId: string;
3348
+ }
3349
+
3350
+ export interface ExperimentWinnerParams {
3351
+ /**
3352
+ * Variant to record as the declared winner (reporting metadata only — does not
3353
+ * change what visitors are served). Omit to clear the declared winner. The
3354
+ * experiment must be completed.
2560
3355
  */
2561
3356
  winnerVariantId?: string;
2562
3357
  }
@@ -2641,6 +3436,9 @@ export declare namespace Experiments {
2641
3436
  type ExperimentDeleteResponse as ExperimentDeleteResponse,
2642
3437
  type ExperimentStartResponse as ExperimentStartResponse,
2643
3438
  type ExperimentStopResponse as ExperimentStopResponse,
3439
+ type ExperimentRolloutResponse as ExperimentRolloutResponse,
3440
+ type ExperimentEndRolloutResponse as ExperimentEndRolloutResponse,
3441
+ type ExperimentWinnerResponse as ExperimentWinnerResponse,
2644
3442
  type ExperimentPauseResponse as ExperimentPauseResponse,
2645
3443
  type ExperimentResumeResponse as ExperimentResumeResponse,
2646
3444
  type ExperimentResultsResponse as ExperimentResultsResponse,
@@ -2652,6 +3450,8 @@ export declare namespace Experiments {
2652
3450
  type ExperimentUpdateParams as ExperimentUpdateParams,
2653
3451
  type ExperimentStartParams as ExperimentStartParams,
2654
3452
  type ExperimentStopParams as ExperimentStopParams,
3453
+ type ExperimentRolloutParams as ExperimentRolloutParams,
3454
+ type ExperimentWinnerParams as ExperimentWinnerParams,
2655
3455
  type ExperimentPauseParams as ExperimentPauseParams,
2656
3456
  type ExperimentResumeParams as ExperimentResumeParams,
2657
3457
  type ExperimentResultsParams as ExperimentResultsParams,