@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.
@@ -80,7 +80,9 @@ export declare class Experiments extends APIResource {
80
80
  start(id: string, body?: ExperimentStartParams | null | undefined, options?: RequestOptions): APIPromise<ExperimentStartResponse>;
81
81
  /**
82
82
  * Stop an experiment. The request body is optional — send `{}` to stop without
83
- * recording a winner. Requires scope: experiment:stop
83
+ * recording a winner. Optionally pass `winnerVariantId` to record the winner
84
+ * (reporting only) and/or `rolloutVariantId` to keep that variant serving to all
85
+ * traffic. Requires scope: experiment:stop
84
86
  *
85
87
  * @example
86
88
  * ```ts
@@ -88,6 +90,45 @@ export declare class Experiments extends APIResource {
88
90
  * ```
89
91
  */
90
92
  stop(id: string, body?: ExperimentStopParams | null | undefined, options?: RequestOptions): APIPromise<ExperimentStopResponse>;
93
+ /**
94
+ * Roll a non-control variant out to 100% of targeted traffic on a completed
95
+ * experiment — the explicit, reversible serving decision that makes a winning
96
+ * experience the ongoing default. Publishes. Reverse with `/end-rollout`. Returns
97
+ * 409 if the experiment is not completed or the variant is the control. Requires
98
+ * scope: experiment:stop
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * const response = await client.experiments.rollout('id', {
103
+ * variantId: 'var_01HZX8YJH3Z3W1R2Q4M5N6P7Q8',
104
+ * });
105
+ * ```
106
+ */
107
+ rollout(id: string, body: ExperimentRolloutParams, options?: RequestOptions): APIPromise<ExperimentRolloutResponse>;
108
+ /**
109
+ * End an active rollout: stop serving the rolled-out variant so every matching
110
+ * visitor reverts to the original experience. The declared winner is left intact.
111
+ * Publishes. Returns 409 if the experiment is not currently rolled out. Requires
112
+ * scope: experiment:stop
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * const response = await client.experiments.endRollout('id');
117
+ * ```
118
+ */
119
+ endRollout(id: string, options?: RequestOptions): APIPromise<ExperimentEndRolloutResponse>;
120
+ /**
121
+ * Declare, change, or clear the winning variant on a completed experiment.
122
+ * Reporting metadata only — it does not change what visitors see and does not
123
+ * republish. Omit `winnerVariantId` to clear. To make the winner live, use
124
+ * `/rollout`. Requires scope: experiment:stop
125
+ *
126
+ * @example
127
+ * ```ts
128
+ * const response = await client.experiments.winner('id');
129
+ * ```
130
+ */
131
+ winner(id: string, body?: ExperimentWinnerParams | null | undefined, options?: RequestOptions): APIPromise<ExperimentWinnerResponse>;
91
132
  /**
92
133
  * Pause a running experiment. Stops new variant assignments while preserving
93
134
  * existing ones; the experiment can later be resumed. The request body is
@@ -200,6 +241,14 @@ export interface ExperimentListResponse {
200
241
  * from a GET response can be PATCHed back without modification.
201
242
  */
202
243
  metrics?: ExperimentListResponse.Metrics | null;
244
+ /**
245
+ * Variant currently rolled out to 100% of targeted traffic on a completed
246
+ * experiment. When set (and not the control), the runtime keeps serving it to
247
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
248
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
249
+ * cleared via `POST /experiments/{id}/end-rollout`.
250
+ */
251
+ rolloutVariantId?: string | null;
203
252
  /**
204
253
  * ISO-8601 timestamp when the experiment most recently entered a running state.
205
254
  */
@@ -224,8 +273,9 @@ export interface ExperimentListResponse {
224
273
  */
225
274
  updatedAt?: string | null;
226
275
  /**
227
- * Variant ID persisted as the winner when the experiment was stopped. Set via
228
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
276
+ * Declared winning variant — reporting metadata only. Records which variant won;
277
+ * does NOT change what visitors are served. Set at stop time or later via
278
+ * `POST /experiments/{id}/winner`.
229
279
  */
230
280
  winnerVariantId?: string | null;
231
281
  }
@@ -366,6 +416,14 @@ export interface ExperimentCreateResponse {
366
416
  * from a GET response can be PATCHed back without modification.
367
417
  */
368
418
  metrics?: ExperimentCreateResponse.Metrics | null;
419
+ /**
420
+ * Variant currently rolled out to 100% of targeted traffic on a completed
421
+ * experiment. When set (and not the control), the runtime keeps serving it to
422
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
423
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
424
+ * cleared via `POST /experiments/{id}/end-rollout`.
425
+ */
426
+ rolloutVariantId?: string | null;
369
427
  /**
370
428
  * ISO-8601 timestamp when the experiment most recently entered a running state.
371
429
  */
@@ -390,8 +448,9 @@ export interface ExperimentCreateResponse {
390
448
  */
391
449
  updatedAt?: string | null;
392
450
  /**
393
- * Variant ID persisted as the winner when the experiment was stopped. Set via
394
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
451
+ * Declared winning variant — reporting metadata only. Records which variant won;
452
+ * does NOT change what visitors are served. Set at stop time or later via
453
+ * `POST /experiments/{id}/winner`.
395
454
  */
396
455
  winnerVariantId?: string | null;
397
456
  }
@@ -615,6 +674,14 @@ export interface ExperimentRetrieveResponse {
615
674
  * from a GET response can be PATCHed back without modification.
616
675
  */
617
676
  metrics?: ExperimentRetrieveResponse.Metrics | null;
677
+ /**
678
+ * Variant currently rolled out to 100% of targeted traffic on a completed
679
+ * experiment. When set (and not the control), the runtime keeps serving it to
680
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
681
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
682
+ * cleared via `POST /experiments/{id}/end-rollout`.
683
+ */
684
+ rolloutVariantId?: string | null;
618
685
  /**
619
686
  * ISO-8601 timestamp when the experiment most recently entered a running state.
620
687
  */
@@ -639,8 +706,9 @@ export interface ExperimentRetrieveResponse {
639
706
  */
640
707
  updatedAt?: string | null;
641
708
  /**
642
- * Variant ID persisted as the winner when the experiment was stopped. Set via
643
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
709
+ * Declared winning variant — reporting metadata only. Records which variant won;
710
+ * does NOT change what visitors are served. Set at stop time or later via
711
+ * `POST /experiments/{id}/winner`.
644
712
  */
645
713
  winnerVariantId?: string | null;
646
714
  }
@@ -858,6 +926,14 @@ export interface ExperimentUpdateResponse {
858
926
  * from a GET response can be PATCHed back without modification.
859
927
  */
860
928
  metrics?: ExperimentUpdateResponse.Metrics | null;
929
+ /**
930
+ * Variant currently rolled out to 100% of targeted traffic on a completed
931
+ * experiment. When set (and not the control), the runtime keeps serving it to
932
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
933
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
934
+ * cleared via `POST /experiments/{id}/end-rollout`.
935
+ */
936
+ rolloutVariantId?: string | null;
861
937
  /**
862
938
  * ISO-8601 timestamp when the experiment most recently entered a running state.
863
939
  */
@@ -882,8 +958,9 @@ export interface ExperimentUpdateResponse {
882
958
  */
883
959
  updatedAt?: string | null;
884
960
  /**
885
- * Variant ID persisted as the winner when the experiment was stopped. Set via
886
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
961
+ * Declared winning variant — reporting metadata only. Records which variant won;
962
+ * does NOT change what visitors are served. Set at stop time or later via
963
+ * `POST /experiments/{id}/winner`.
887
964
  */
888
965
  winnerVariantId?: string | null;
889
966
  }
@@ -1037,6 +1114,14 @@ export declare namespace ExperimentStartResponse {
1037
1114
  * from a GET response can be PATCHed back without modification.
1038
1115
  */
1039
1116
  metrics?: Experiment.Metrics | null;
1117
+ /**
1118
+ * Variant currently rolled out to 100% of targeted traffic on a completed
1119
+ * experiment. When set (and not the control), the runtime keeps serving it to
1120
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
1121
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
1122
+ * cleared via `POST /experiments/{id}/end-rollout`.
1123
+ */
1124
+ rolloutVariantId?: string | null;
1040
1125
  /**
1041
1126
  * ISO-8601 timestamp when the experiment most recently entered a running state.
1042
1127
  */
@@ -1061,8 +1146,9 @@ export declare namespace ExperimentStartResponse {
1061
1146
  */
1062
1147
  updatedAt?: string | null;
1063
1148
  /**
1064
- * Variant ID persisted as the winner when the experiment was stopped. Set via
1065
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
1149
+ * Declared winning variant — reporting metadata only. Records which variant won;
1150
+ * does NOT change what visitors are served. Set at stop time or later via
1151
+ * `POST /experiments/{id}/winner`.
1066
1152
  */
1067
1153
  winnerVariantId?: string | null;
1068
1154
  }
@@ -1213,6 +1299,14 @@ export declare namespace ExperimentStopResponse {
1213
1299
  * from a GET response can be PATCHed back without modification.
1214
1300
  */
1215
1301
  metrics?: Experiment.Metrics | null;
1302
+ /**
1303
+ * Variant currently rolled out to 100% of targeted traffic on a completed
1304
+ * experiment. When set (and not the control), the runtime keeps serving it to
1305
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
1306
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
1307
+ * cleared via `POST /experiments/{id}/end-rollout`.
1308
+ */
1309
+ rolloutVariantId?: string | null;
1216
1310
  /**
1217
1311
  * ISO-8601 timestamp when the experiment most recently entered a running state.
1218
1312
  */
@@ -1237,8 +1331,9 @@ export declare namespace ExperimentStopResponse {
1237
1331
  */
1238
1332
  updatedAt?: string | null;
1239
1333
  /**
1240
- * Variant ID persisted as the winner when the experiment was stopped. Set via
1241
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
1334
+ * Declared winning variant — reporting metadata only. Records which variant won;
1335
+ * does NOT change what visitors are served. Set at stop time or later via
1336
+ * `POST /experiments/{id}/winner`.
1242
1337
  */
1243
1338
  winnerVariantId?: string | null;
1244
1339
  }
@@ -1330,21 +1425,21 @@ export declare namespace ExperimentStopResponse {
1330
1425
  }
1331
1426
  }
1332
1427
  }
1333
- export interface ExperimentPauseResponse {
1428
+ export interface ExperimentRolloutResponse {
1334
1429
  /**
1335
1430
  * Number of unpublished version changes detected at the time of the lifecycle
1336
1431
  * action. Values greater than 1 mean other unpublished work exists besides this
1337
1432
  * experiment state change.
1338
1433
  */
1339
1434
  concurrentVersionChanges: number;
1340
- experiment: ExperimentPauseResponse.Experiment;
1435
+ experiment: ExperimentRolloutResponse.Experiment;
1341
1436
  /**
1342
1437
  * Whether the status change was also published to the current live version
1343
1438
  * immediately.
1344
1439
  */
1345
1440
  publishStatus: 'pending_publish' | 'published';
1346
1441
  }
1347
- export declare namespace ExperimentPauseResponse {
1442
+ export declare namespace ExperimentRolloutResponse {
1348
1443
  interface Experiment {
1349
1444
  /**
1350
1445
  * Unique identifier for the experiment.
@@ -1389,6 +1484,14 @@ export declare namespace ExperimentPauseResponse {
1389
1484
  * from a GET response can be PATCHed back without modification.
1390
1485
  */
1391
1486
  metrics?: Experiment.Metrics | null;
1487
+ /**
1488
+ * Variant currently rolled out to 100% of targeted traffic on a completed
1489
+ * experiment. When set (and not the control), the runtime keeps serving it to
1490
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
1491
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
1492
+ * cleared via `POST /experiments/{id}/end-rollout`.
1493
+ */
1494
+ rolloutVariantId?: string | null;
1392
1495
  /**
1393
1496
  * ISO-8601 timestamp when the experiment most recently entered a running state.
1394
1497
  */
@@ -1413,8 +1516,9 @@ export declare namespace ExperimentPauseResponse {
1413
1516
  */
1414
1517
  updatedAt?: string | null;
1415
1518
  /**
1416
- * Variant ID persisted as the winner when the experiment was stopped. Set via
1417
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
1519
+ * Declared winning variant — reporting metadata only. Records which variant won;
1520
+ * does NOT change what visitors are served. Set at stop time or later via
1521
+ * `POST /experiments/{id}/winner`.
1418
1522
  */
1419
1523
  winnerVariantId?: string | null;
1420
1524
  }
@@ -1506,21 +1610,21 @@ export declare namespace ExperimentPauseResponse {
1506
1610
  }
1507
1611
  }
1508
1612
  }
1509
- export interface ExperimentResumeResponse {
1613
+ export interface ExperimentEndRolloutResponse {
1510
1614
  /**
1511
1615
  * Number of unpublished version changes detected at the time of the lifecycle
1512
1616
  * action. Values greater than 1 mean other unpublished work exists besides this
1513
1617
  * experiment state change.
1514
1618
  */
1515
1619
  concurrentVersionChanges: number;
1516
- experiment: ExperimentResumeResponse.Experiment;
1620
+ experiment: ExperimentEndRolloutResponse.Experiment;
1517
1621
  /**
1518
1622
  * Whether the status change was also published to the current live version
1519
1623
  * immediately.
1520
1624
  */
1521
1625
  publishStatus: 'pending_publish' | 'published';
1522
1626
  }
1523
- export declare namespace ExperimentResumeResponse {
1627
+ export declare namespace ExperimentEndRolloutResponse {
1524
1628
  interface Experiment {
1525
1629
  /**
1526
1630
  * Unique identifier for the experiment.
@@ -1565,6 +1669,14 @@ export declare namespace ExperimentResumeResponse {
1565
1669
  * from a GET response can be PATCHed back without modification.
1566
1670
  */
1567
1671
  metrics?: Experiment.Metrics | null;
1672
+ /**
1673
+ * Variant currently rolled out to 100% of targeted traffic on a completed
1674
+ * experiment. When set (and not the control), the runtime keeps serving it to
1675
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
1676
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
1677
+ * cleared via `POST /experiments/{id}/end-rollout`.
1678
+ */
1679
+ rolloutVariantId?: string | null;
1568
1680
  /**
1569
1681
  * ISO-8601 timestamp when the experiment most recently entered a running state.
1570
1682
  */
@@ -1589,8 +1701,9 @@ export declare namespace ExperimentResumeResponse {
1589
1701
  */
1590
1702
  updatedAt?: string | null;
1591
1703
  /**
1592
- * Variant ID persisted as the winner when the experiment was stopped. Set via
1593
- * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
1704
+ * Declared winning variant — reporting metadata only. Records which variant won;
1705
+ * does NOT change what visitors are served. Set at stop time or later via
1706
+ * `POST /experiments/{id}/winner`.
1594
1707
  */
1595
1708
  winnerVariantId?: string | null;
1596
1709
  }
@@ -1682,227 +1795,766 @@ export declare namespace ExperimentResumeResponse {
1682
1795
  }
1683
1796
  }
1684
1797
  }
1685
- export interface ExperimentResultsResponse {
1798
+ export interface ExperimentWinnerResponse {
1686
1799
  /**
1687
- * Aggregate performance metrics for each variant in the experiment over the
1688
- * experiment runtime window.
1800
+ * Unique identifier for the experiment.
1689
1801
  */
1690
- variants: Array<ExperimentResultsResponse.Variant>;
1691
- }
1692
- export declare namespace ExperimentResultsResponse {
1693
- interface Variant {
1694
- /**
1695
- * Variant ID this result row belongs to.
1696
- */
1697
- id: string;
1698
- /**
1699
- * Conversions divided by impressions for this variant.
1700
- */
1701
- conversionRate: number;
1702
- /**
1703
- * Number of post-exposure conversions attributed to the variant.
1704
- */
1705
- conversions: number;
1706
- /**
1707
- * Number of distinct experiment-impression events counted for the variant.
1708
- */
1709
- impressions: number;
1710
- /**
1711
- * Whether this variant is the experiment control. Exactly one variant per
1712
- * experiment is the control.
1713
- */
1714
- isControl: boolean;
1715
- /**
1716
- * Human-readable variant name as configured on the experiment (e.g. `Control`,
1717
- * `Treatment`). Lets callers label results without a separate lookup against
1718
- * `/experiment-variants`.
1719
- */
1720
- name: string;
1721
- /**
1722
- * Bayesian probability that this variant is the best-performing option among all
1723
- * variants in the experiment.
1724
- */
1725
- probabilityToBeBest: number;
1726
- }
1727
- }
1728
- export interface ExperimentResultsTimeSeriesResponse {
1802
+ id: string;
1729
1803
  /**
1730
- * Per-day metrics for each variant. Days with no impression rows are omitted from
1731
- * the response.
1804
+ * ISO-8601 timestamp when the experiment was created.
1732
1805
  */
1733
- days: Array<ExperimentResultsTimeSeriesResponse.Day>;
1734
- }
1735
- export declare namespace ExperimentResultsTimeSeriesResponse {
1736
- interface Day {
1737
- /**
1738
- * UTC calendar day in `YYYY-MM-DD` format.
1739
- */
1740
- date: string;
1741
- variants: Array<Day.Variant>;
1742
- }
1743
- namespace Day {
1744
- interface Variant {
1745
- id: string;
1746
- conversionRate: number;
1747
- conversions: number;
1748
- impressions: number;
1749
- }
1750
- }
1751
- }
1752
- export interface ExperimentSessionReplaysResponse {
1806
+ createdAt: string;
1753
1807
  /**
1754
- * Sessions in which a `$experiment_impression` event for this experiment was
1755
- * recorded, ordered newest first by session start time.
1808
+ * Stable code-facing key for the experiment. Use this with the headless SDK
1809
+ * `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
1810
+ * application code.
1756
1811
  */
1757
- entities: Array<ExperimentSessionReplaysResponse.Entity>;
1758
- pagination: ExperimentSessionReplaysResponse.Pagination;
1759
- }
1760
- export declare namespace ExperimentSessionReplaysResponse {
1761
- interface Entity {
1762
- /**
1763
- * Time between the first and last events recorded for this session, in whole
1764
- * seconds.
1765
- */
1766
- durationSeconds: number;
1767
- /**
1768
- * Number of distinct page paths visited during this session.
1769
- */
1770
- pageCount: number;
1771
- /**
1772
- * Deep link to the in-app replay viewer for this session. Requires an
1773
- * authenticated session in the Ours Privacy app for an account that owns this
1774
- * experiment — not embeddable in customer-facing emails.
1775
- */
1776
- replayUrl: string;
1777
- /**
1778
- * Session identifier (`dp_sid`). Combine with `visitorId` and the `YYYY-MM-DD`
1779
- * date of `startTime` to deep-link to a replay outside of the response
1780
- * `replayUrl`.
1781
- */
1782
- sessionId: string;
1783
- /**
1784
- * ISO-8601 timestamp of the first event recorded in this session. Sessions are
1785
- * ordered newest first by this field.
1786
- */
1787
- startTime: string;
1788
- /**
1789
- * Human-readable name of the variant the visitor was assigned for the recorded
1790
- * impression. May be empty if the variant has been deleted since the impression
1791
- * fired.
1792
- */
1793
- variantName: string;
1794
- /**
1795
- * Visitor identifier whose session is recorded here.
1796
- */
1797
- visitorId: string;
1798
- }
1799
- interface Pagination {
1800
- hasMore: boolean;
1801
- nextCursor?: string | null;
1802
- }
1803
- }
1804
- export interface ExperimentListParams extends CursorParams {
1812
+ key: string;
1805
1813
  /**
1806
- * Optional case-insensitive text search matched against experiment ID, name, and
1807
- * description.
1814
+ * Short, human-readable experiment name.
1808
1815
  */
1809
- search?: string;
1816
+ name: string;
1810
1817
  /**
1811
- * Optional lifecycle-state filter.
1818
+ * Lifecycle state. `draft` is editable, `running` is active, `paused` is
1819
+ * temporarily inactive, and `completed` is permanently stopped.
1812
1820
  */
1813
- status?: 'completed' | 'draft' | 'paused' | 'running';
1821
+ status: 'completed' | 'draft' | 'paused' | 'running';
1814
1822
  /**
1815
- * Optional experiment-type filter.
1823
+ * Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
1824
+ * enrollment without deleting the experiment.
1816
1825
  */
1817
- type?: 'ab' | 'multivariate' | 'personalization';
1818
- }
1819
- export interface ExperimentCreateParams {
1826
+ trafficAllocation: number;
1820
1827
  /**
1821
- * ID of the experiment settings record that owns this experiment. Call
1822
- * `GET /rest/v1/experiment-settings` first if you need to discover the correct ID
1823
- * for the current account.
1828
+ * Optional human-readable hypothesis or summary. In GraphQL this is backed by the
1829
+ * experiment hypothesis field.
1824
1830
  */
1825
- experimentSettingsId: string;
1831
+ description?: string | null;
1826
1832
  /**
1827
- * Short experiment name.
1833
+ * For redirect variants, whether the original page query string should be
1834
+ * forwarded onto the redirect URL.
1828
1835
  */
1829
- name: string;
1836
+ includeQueryString?: boolean | null;
1830
1837
  /**
1831
- * Weight of the auto-created control variant, as a percentage (1–100). Defaults to
1832
- * 100 (a new experiment is all control until treatments are added). The control
1833
- * must keep at least 1% — a 0% control leaves visitors with no bucket to assign at
1834
- * runtime. As treatments are added the control is reconciled to the remainder (100
1835
- * − Σ treatment weights), so it normally does not need to be set explicitly.
1838
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
1839
+ * from a GET response can be PATCHed back without modification.
1836
1840
  */
1837
- controlWeight?: number | null;
1841
+ metrics?: ExperimentWinnerResponse.Metrics | null;
1838
1842
  /**
1839
- * Optional hypothesis or operator note.
1843
+ * Variant currently rolled out to 100% of targeted traffic on a completed
1844
+ * experiment. When set (and not the control), the runtime keeps serving it to
1845
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
1846
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
1847
+ * cleared via `POST /experiments/{id}/end-rollout`.
1840
1848
  */
1841
- description?: string | null;
1849
+ rolloutVariantId?: string | null;
1842
1850
  /**
1843
- * Whether redirect variants in this experiment should preserve the original
1844
- * request query string.
1851
+ * ISO-8601 timestamp when the experiment most recently entered a running state.
1845
1852
  */
1846
- includeQueryString?: boolean | null;
1853
+ startedAt?: string | null;
1847
1854
  /**
1848
- * Optional stable code-facing key. When omitted, the API slugifies the name
1849
- * automatically.
1855
+ * ISO-8601 timestamp when the experiment was completed, if it has been stopped.
1850
1856
  */
1851
- key?: string | null;
1857
+ stoppedAt?: string | null;
1852
1858
  /**
1853
- * Goal events. If you send `metrics.primary`, `metrics.primary.eventName` must be
1854
- * a non-blank string. A primary event name is required before the experiment can
1855
- * be started.
1859
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
1860
+ * visitor status, and (server-side) visitor properties. Same shape as the
1861
+ * create/patch input.
1856
1862
  */
1857
- metrics?: ExperimentCreateParams.Metrics | null;
1863
+ targetingRules?: ExperimentWinnerResponse.TargetingRules | null;
1858
1864
  /**
1859
- * Eligibility rules — URL patterns, audience, visitor status, query-param
1860
- * conditions. Omit to inherit defaults.
1865
+ * Experiment mode. `ab` and `multivariate` use traffic allocation and results;
1866
+ * `personalization` is always-on targeting.
1861
1867
  */
1862
- targetingRules?: ExperimentCreateParams.TargetingRules | null;
1868
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
1863
1869
  /**
1864
- * Initial traffic allocation percentage from 0 to 100.
1870
+ * ISO-8601 timestamp for the last persisted update, if any.
1865
1871
  */
1866
- trafficAllocation?: number | null;
1872
+ updatedAt?: string | null;
1867
1873
  /**
1868
- * Experiment mode to create. `ab` and `multivariate` use traffic allocation and
1869
- * results; `personalization` is always-on targeting. Omit to create a standard
1870
- * `ab` experiment.
1874
+ * Declared winning variant — reporting metadata only. Records which variant won;
1875
+ * does NOT change what visitors are served. Set at stop time or later via
1876
+ * `POST /experiments/{id}/winner`.
1871
1877
  */
1872
- type?: 'ab' | 'multivariate' | 'personalization' | null;
1878
+ winnerVariantId?: string | null;
1873
1879
  }
1874
- export declare namespace ExperimentCreateParams {
1880
+ export declare namespace ExperimentWinnerResponse {
1875
1881
  /**
1876
- * Goal events. If you send `metrics.primary`, `metrics.primary.eventName` must be
1877
- * a non-blank string. A primary event name is required before the experiment can
1878
- * be started.
1882
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
1883
+ * from a GET response can be PATCHed back without modification.
1879
1884
  */
1880
1885
  interface Metrics {
1881
1886
  /**
1882
- * Primary success metric. When provided, `eventName` must be a non-blank string.
1887
+ * Primary success metric used in the results report.
1883
1888
  */
1884
- primary?: Metrics.Primary | null;
1889
+ primary?: unknown | null;
1885
1890
  /**
1886
1891
  * Optional secondary metrics tracked alongside the primary goal.
1887
1892
  */
1888
1893
  secondary?: Array<Metrics.Secondary> | null;
1889
1894
  }
1890
1895
  namespace Metrics {
1891
- /**
1892
- * Primary success metric. When provided, `eventName` must be a non-blank string.
1893
- */
1894
- interface Primary {
1896
+ interface Secondary {
1895
1897
  /**
1896
- * Event name to use as the goal for this metric.
1898
+ * Name of the event used to measure success for this metric.
1897
1899
  */
1898
1900
  eventName?: string | null;
1899
1901
  /**
1900
- * Optional funnel identifier when the metric should be derived from an existing
1901
- * funnel definition.
1902
+ * Optional funnel identifier when the metric is derived from an existing funnel
1903
+ * definition.
1902
1904
  */
1903
1905
  funnelId?: string | null;
1904
1906
  }
1905
- interface Secondary {
1907
+ }
1908
+ /**
1909
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
1910
+ * visitor status, and (server-side) visitor properties. Same shape as the
1911
+ * create/patch input.
1912
+ */
1913
+ interface TargetingRules {
1914
+ /**
1915
+ * Glob-style URL patterns that must match for the experiment to be eligible. Each
1916
+ * pattern is either a path (`/pricing`, matched on any domain) or a host-qualified
1917
+ * pattern (`get.example.com/pricing` or `https://get.example.com/pricing`, matched
1918
+ * against the full URL so a single domain or subdomain can be targeted). Use `*`
1919
+ * to match within a path segment and `**` to match across segments. Up to 200
1920
+ * patterns; each pattern up to 2000 characters. An empty array (or omitting the
1921
+ * field) matches all URLs — equivalent to `['**']`. The host(s) targeted here must
1922
+ * also appear in the parent experiment settings' `whitelistDomains` — that
1923
+ * allowlist is what limits which domains can load your experiments (see
1924
+ * `GET /experiment-settings`). If the host is missing, the SDK refuses to load
1925
+ * there and the experiment never runs, even after `POST /experiments/{id}/start`
1926
+ * succeeds.
1927
+ */
1928
+ urlPatterns: Array<string>;
1929
+ /**
1930
+ * Optional audience identifier used for server-side eligibility filtering.
1931
+ */
1932
+ audienceId?: string | null;
1933
+ /**
1934
+ * Additional query-string conditions that must all match for the visitor to
1935
+ * qualify.
1936
+ */
1937
+ queryParams?: Array<TargetingRules.QueryParam> | null;
1938
+ /**
1939
+ * Optional visitor-property matching rules. These are passed through as JSON for
1940
+ * experimentation targeting.
1941
+ */
1942
+ visitorProperties?: unknown | null;
1943
+ /**
1944
+ * Whether the experiment should target new visitors, returning visitors, or any
1945
+ * visitor.
1946
+ */
1947
+ visitorStatus?: string | null;
1948
+ }
1949
+ namespace TargetingRules {
1950
+ interface QueryParam {
1951
+ /**
1952
+ * Query string key to inspect on the current page URL.
1953
+ */
1954
+ key: string;
1955
+ /**
1956
+ * Comparison operator applied to the query string value.
1957
+ */
1958
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists' | 'regex';
1959
+ /**
1960
+ * Comparison value used by operators that require one. Omit for `exists` and
1961
+ * `not_exists`.
1962
+ */
1963
+ value?: string | null;
1964
+ }
1965
+ }
1966
+ }
1967
+ export interface ExperimentPauseResponse {
1968
+ /**
1969
+ * Number of unpublished version changes detected at the time of the lifecycle
1970
+ * action. Values greater than 1 mean other unpublished work exists besides this
1971
+ * experiment state change.
1972
+ */
1973
+ concurrentVersionChanges: number;
1974
+ experiment: ExperimentPauseResponse.Experiment;
1975
+ /**
1976
+ * Whether the status change was also published to the current live version
1977
+ * immediately.
1978
+ */
1979
+ publishStatus: 'pending_publish' | 'published';
1980
+ }
1981
+ export declare namespace ExperimentPauseResponse {
1982
+ interface Experiment {
1983
+ /**
1984
+ * Unique identifier for the experiment.
1985
+ */
1986
+ id: string;
1987
+ /**
1988
+ * ISO-8601 timestamp when the experiment was created.
1989
+ */
1990
+ createdAt: string;
1991
+ /**
1992
+ * Stable code-facing key for the experiment. Use this with the headless SDK
1993
+ * `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
1994
+ * application code.
1995
+ */
1996
+ key: string;
1997
+ /**
1998
+ * Short, human-readable experiment name.
1999
+ */
2000
+ name: string;
2001
+ /**
2002
+ * Lifecycle state. `draft` is editable, `running` is active, `paused` is
2003
+ * temporarily inactive, and `completed` is permanently stopped.
2004
+ */
2005
+ status: 'completed' | 'draft' | 'paused' | 'running';
2006
+ /**
2007
+ * Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
2008
+ * enrollment without deleting the experiment.
2009
+ */
2010
+ trafficAllocation: number;
2011
+ /**
2012
+ * Optional human-readable hypothesis or summary. In GraphQL this is backed by the
2013
+ * experiment hypothesis field.
2014
+ */
2015
+ description?: string | null;
2016
+ /**
2017
+ * For redirect variants, whether the original page query string should be
2018
+ * forwarded onto the redirect URL.
2019
+ */
2020
+ includeQueryString?: boolean | null;
2021
+ /**
2022
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
2023
+ * from a GET response can be PATCHed back without modification.
2024
+ */
2025
+ metrics?: Experiment.Metrics | null;
2026
+ /**
2027
+ * Variant currently rolled out to 100% of targeted traffic on a completed
2028
+ * experiment. When set (and not the control), the runtime keeps serving it to
2029
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
2030
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
2031
+ * cleared via `POST /experiments/{id}/end-rollout`.
2032
+ */
2033
+ rolloutVariantId?: string | null;
2034
+ /**
2035
+ * ISO-8601 timestamp when the experiment most recently entered a running state.
2036
+ */
2037
+ startedAt?: string | null;
2038
+ /**
2039
+ * ISO-8601 timestamp when the experiment was completed, if it has been stopped.
2040
+ */
2041
+ stoppedAt?: string | null;
2042
+ /**
2043
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
2044
+ * visitor status, and (server-side) visitor properties. Same shape as the
2045
+ * create/patch input.
2046
+ */
2047
+ targetingRules?: Experiment.TargetingRules | null;
2048
+ /**
2049
+ * Experiment mode. `ab` and `multivariate` use traffic allocation and results;
2050
+ * `personalization` is always-on targeting.
2051
+ */
2052
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
2053
+ /**
2054
+ * ISO-8601 timestamp for the last persisted update, if any.
2055
+ */
2056
+ updatedAt?: string | null;
2057
+ /**
2058
+ * Declared winning variant — reporting metadata only. Records which variant won;
2059
+ * does NOT change what visitors are served. Set at stop time or later via
2060
+ * `POST /experiments/{id}/winner`.
2061
+ */
2062
+ winnerVariantId?: string | null;
2063
+ }
2064
+ namespace Experiment {
2065
+ /**
2066
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
2067
+ * from a GET response can be PATCHed back without modification.
2068
+ */
2069
+ interface Metrics {
2070
+ /**
2071
+ * Primary success metric used in the results report.
2072
+ */
2073
+ primary?: unknown | null;
2074
+ /**
2075
+ * Optional secondary metrics tracked alongside the primary goal.
2076
+ */
2077
+ secondary?: Array<Metrics.Secondary> | null;
2078
+ }
2079
+ namespace Metrics {
2080
+ interface Secondary {
2081
+ /**
2082
+ * Name of the event used to measure success for this metric.
2083
+ */
2084
+ eventName?: string | null;
2085
+ /**
2086
+ * Optional funnel identifier when the metric is derived from an existing funnel
2087
+ * definition.
2088
+ */
2089
+ funnelId?: string | null;
2090
+ }
2091
+ }
2092
+ /**
2093
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
2094
+ * visitor status, and (server-side) visitor properties. Same shape as the
2095
+ * create/patch input.
2096
+ */
2097
+ interface TargetingRules {
2098
+ /**
2099
+ * Glob-style URL patterns that must match for the experiment to be eligible. Each
2100
+ * pattern is either a path (`/pricing`, matched on any domain) or a host-qualified
2101
+ * pattern (`get.example.com/pricing` or `https://get.example.com/pricing`, matched
2102
+ * against the full URL so a single domain or subdomain can be targeted). Use `*`
2103
+ * to match within a path segment and `**` to match across segments. Up to 200
2104
+ * patterns; each pattern up to 2000 characters. An empty array (or omitting the
2105
+ * field) matches all URLs — equivalent to `['**']`. The host(s) targeted here must
2106
+ * also appear in the parent experiment settings' `whitelistDomains` — that
2107
+ * allowlist is what limits which domains can load your experiments (see
2108
+ * `GET /experiment-settings`). If the host is missing, the SDK refuses to load
2109
+ * there and the experiment never runs, even after `POST /experiments/{id}/start`
2110
+ * succeeds.
2111
+ */
2112
+ urlPatterns: Array<string>;
2113
+ /**
2114
+ * Optional audience identifier used for server-side eligibility filtering.
2115
+ */
2116
+ audienceId?: string | null;
2117
+ /**
2118
+ * Additional query-string conditions that must all match for the visitor to
2119
+ * qualify.
2120
+ */
2121
+ queryParams?: Array<TargetingRules.QueryParam> | null;
2122
+ /**
2123
+ * Optional visitor-property matching rules. These are passed through as JSON for
2124
+ * experimentation targeting.
2125
+ */
2126
+ visitorProperties?: unknown | null;
2127
+ /**
2128
+ * Whether the experiment should target new visitors, returning visitors, or any
2129
+ * visitor.
2130
+ */
2131
+ visitorStatus?: string | null;
2132
+ }
2133
+ namespace TargetingRules {
2134
+ interface QueryParam {
2135
+ /**
2136
+ * Query string key to inspect on the current page URL.
2137
+ */
2138
+ key: string;
2139
+ /**
2140
+ * Comparison operator applied to the query string value.
2141
+ */
2142
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists' | 'regex';
2143
+ /**
2144
+ * Comparison value used by operators that require one. Omit for `exists` and
2145
+ * `not_exists`.
2146
+ */
2147
+ value?: string | null;
2148
+ }
2149
+ }
2150
+ }
2151
+ }
2152
+ export interface ExperimentResumeResponse {
2153
+ /**
2154
+ * Number of unpublished version changes detected at the time of the lifecycle
2155
+ * action. Values greater than 1 mean other unpublished work exists besides this
2156
+ * experiment state change.
2157
+ */
2158
+ concurrentVersionChanges: number;
2159
+ experiment: ExperimentResumeResponse.Experiment;
2160
+ /**
2161
+ * Whether the status change was also published to the current live version
2162
+ * immediately.
2163
+ */
2164
+ publishStatus: 'pending_publish' | 'published';
2165
+ }
2166
+ export declare namespace ExperimentResumeResponse {
2167
+ interface Experiment {
2168
+ /**
2169
+ * Unique identifier for the experiment.
2170
+ */
2171
+ id: string;
2172
+ /**
2173
+ * ISO-8601 timestamp when the experiment was created.
2174
+ */
2175
+ createdAt: string;
2176
+ /**
2177
+ * Stable code-facing key for the experiment. Use this with the headless SDK
2178
+ * `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
2179
+ * application code.
2180
+ */
2181
+ key: string;
2182
+ /**
2183
+ * Short, human-readable experiment name.
2184
+ */
2185
+ name: string;
2186
+ /**
2187
+ * Lifecycle state. `draft` is editable, `running` is active, `paused` is
2188
+ * temporarily inactive, and `completed` is permanently stopped.
2189
+ */
2190
+ status: 'completed' | 'draft' | 'paused' | 'running';
2191
+ /**
2192
+ * Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
2193
+ * enrollment without deleting the experiment.
2194
+ */
2195
+ trafficAllocation: number;
2196
+ /**
2197
+ * Optional human-readable hypothesis or summary. In GraphQL this is backed by the
2198
+ * experiment hypothesis field.
2199
+ */
2200
+ description?: string | null;
2201
+ /**
2202
+ * For redirect variants, whether the original page query string should be
2203
+ * forwarded onto the redirect URL.
2204
+ */
2205
+ includeQueryString?: boolean | null;
2206
+ /**
2207
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
2208
+ * from a GET response can be PATCHed back without modification.
2209
+ */
2210
+ metrics?: Experiment.Metrics | null;
2211
+ /**
2212
+ * Variant currently rolled out to 100% of targeted traffic on a completed
2213
+ * experiment. When set (and not the control), the runtime keeps serving it to
2214
+ * every matching visitor — a winning redirect becomes an ongoing redirect.
2215
+ * Independent of `winnerVariantId`. Set via `POST /experiments/{id}/rollout`;
2216
+ * cleared via `POST /experiments/{id}/end-rollout`.
2217
+ */
2218
+ rolloutVariantId?: string | null;
2219
+ /**
2220
+ * ISO-8601 timestamp when the experiment most recently entered a running state.
2221
+ */
2222
+ startedAt?: string | null;
2223
+ /**
2224
+ * ISO-8601 timestamp when the experiment was completed, if it has been stopped.
2225
+ */
2226
+ stoppedAt?: string | null;
2227
+ /**
2228
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
2229
+ * visitor status, and (server-side) visitor properties. Same shape as the
2230
+ * create/patch input.
2231
+ */
2232
+ targetingRules?: Experiment.TargetingRules | null;
2233
+ /**
2234
+ * Experiment mode. `ab` and `multivariate` use traffic allocation and results;
2235
+ * `personalization` is always-on targeting.
2236
+ */
2237
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
2238
+ /**
2239
+ * ISO-8601 timestamp for the last persisted update, if any.
2240
+ */
2241
+ updatedAt?: string | null;
2242
+ /**
2243
+ * Declared winning variant — reporting metadata only. Records which variant won;
2244
+ * does NOT change what visitors are served. Set at stop time or later via
2245
+ * `POST /experiments/{id}/winner`.
2246
+ */
2247
+ winnerVariantId?: string | null;
2248
+ }
2249
+ namespace Experiment {
2250
+ /**
2251
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
2252
+ * from a GET response can be PATCHed back without modification.
2253
+ */
2254
+ interface Metrics {
2255
+ /**
2256
+ * Primary success metric used in the results report.
2257
+ */
2258
+ primary?: unknown | null;
2259
+ /**
2260
+ * Optional secondary metrics tracked alongside the primary goal.
2261
+ */
2262
+ secondary?: Array<Metrics.Secondary> | null;
2263
+ }
2264
+ namespace Metrics {
2265
+ interface Secondary {
2266
+ /**
2267
+ * Name of the event used to measure success for this metric.
2268
+ */
2269
+ eventName?: string | null;
2270
+ /**
2271
+ * Optional funnel identifier when the metric is derived from an existing funnel
2272
+ * definition.
2273
+ */
2274
+ funnelId?: string | null;
2275
+ }
2276
+ }
2277
+ /**
2278
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
2279
+ * visitor status, and (server-side) visitor properties. Same shape as the
2280
+ * create/patch input.
2281
+ */
2282
+ interface TargetingRules {
2283
+ /**
2284
+ * Glob-style URL patterns that must match for the experiment to be eligible. Each
2285
+ * pattern is either a path (`/pricing`, matched on any domain) or a host-qualified
2286
+ * pattern (`get.example.com/pricing` or `https://get.example.com/pricing`, matched
2287
+ * against the full URL so a single domain or subdomain can be targeted). Use `*`
2288
+ * to match within a path segment and `**` to match across segments. Up to 200
2289
+ * patterns; each pattern up to 2000 characters. An empty array (or omitting the
2290
+ * field) matches all URLs — equivalent to `['**']`. The host(s) targeted here must
2291
+ * also appear in the parent experiment settings' `whitelistDomains` — that
2292
+ * allowlist is what limits which domains can load your experiments (see
2293
+ * `GET /experiment-settings`). If the host is missing, the SDK refuses to load
2294
+ * there and the experiment never runs, even after `POST /experiments/{id}/start`
2295
+ * succeeds.
2296
+ */
2297
+ urlPatterns: Array<string>;
2298
+ /**
2299
+ * Optional audience identifier used for server-side eligibility filtering.
2300
+ */
2301
+ audienceId?: string | null;
2302
+ /**
2303
+ * Additional query-string conditions that must all match for the visitor to
2304
+ * qualify.
2305
+ */
2306
+ queryParams?: Array<TargetingRules.QueryParam> | null;
2307
+ /**
2308
+ * Optional visitor-property matching rules. These are passed through as JSON for
2309
+ * experimentation targeting.
2310
+ */
2311
+ visitorProperties?: unknown | null;
2312
+ /**
2313
+ * Whether the experiment should target new visitors, returning visitors, or any
2314
+ * visitor.
2315
+ */
2316
+ visitorStatus?: string | null;
2317
+ }
2318
+ namespace TargetingRules {
2319
+ interface QueryParam {
2320
+ /**
2321
+ * Query string key to inspect on the current page URL.
2322
+ */
2323
+ key: string;
2324
+ /**
2325
+ * Comparison operator applied to the query string value.
2326
+ */
2327
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists' | 'regex';
2328
+ /**
2329
+ * Comparison value used by operators that require one. Omit for `exists` and
2330
+ * `not_exists`.
2331
+ */
2332
+ value?: string | null;
2333
+ }
2334
+ }
2335
+ }
2336
+ }
2337
+ export interface ExperimentResultsResponse {
2338
+ /**
2339
+ * Aggregate performance metrics for each variant in the experiment over the
2340
+ * experiment runtime window.
2341
+ */
2342
+ variants: Array<ExperimentResultsResponse.Variant>;
2343
+ }
2344
+ export declare namespace ExperimentResultsResponse {
2345
+ interface Variant {
2346
+ /**
2347
+ * Variant ID this result row belongs to.
2348
+ */
2349
+ id: string;
2350
+ /**
2351
+ * Conversions divided by impressions for this variant.
2352
+ */
2353
+ conversionRate: number;
2354
+ /**
2355
+ * Number of post-exposure conversions attributed to the variant.
2356
+ */
2357
+ conversions: number;
2358
+ /**
2359
+ * Number of distinct experiment-impression events counted for the variant.
2360
+ */
2361
+ impressions: number;
2362
+ /**
2363
+ * Whether this variant is the experiment control. Exactly one variant per
2364
+ * experiment is the control.
2365
+ */
2366
+ isControl: boolean;
2367
+ /**
2368
+ * Human-readable variant name as configured on the experiment (e.g. `Control`,
2369
+ * `Treatment`). Lets callers label results without a separate lookup against
2370
+ * `/experiment-variants`.
2371
+ */
2372
+ name: string;
2373
+ /**
2374
+ * Bayesian probability that this variant is the best-performing option among all
2375
+ * variants in the experiment.
2376
+ */
2377
+ probabilityToBeBest: number;
2378
+ }
2379
+ }
2380
+ export interface ExperimentResultsTimeSeriesResponse {
2381
+ /**
2382
+ * Per-day metrics for each variant. Days with no impression rows are omitted from
2383
+ * the response.
2384
+ */
2385
+ days: Array<ExperimentResultsTimeSeriesResponse.Day>;
2386
+ }
2387
+ export declare namespace ExperimentResultsTimeSeriesResponse {
2388
+ interface Day {
2389
+ /**
2390
+ * UTC calendar day in `YYYY-MM-DD` format.
2391
+ */
2392
+ date: string;
2393
+ variants: Array<Day.Variant>;
2394
+ }
2395
+ namespace Day {
2396
+ interface Variant {
2397
+ id: string;
2398
+ conversionRate: number;
2399
+ conversions: number;
2400
+ impressions: number;
2401
+ }
2402
+ }
2403
+ }
2404
+ export interface ExperimentSessionReplaysResponse {
2405
+ /**
2406
+ * Sessions in which a `$experiment_impression` event for this experiment was
2407
+ * recorded, ordered newest first by session start time.
2408
+ */
2409
+ entities: Array<ExperimentSessionReplaysResponse.Entity>;
2410
+ pagination: ExperimentSessionReplaysResponse.Pagination;
2411
+ }
2412
+ export declare namespace ExperimentSessionReplaysResponse {
2413
+ interface Entity {
2414
+ /**
2415
+ * Time between the first and last events recorded for this session, in whole
2416
+ * seconds.
2417
+ */
2418
+ durationSeconds: number;
2419
+ /**
2420
+ * Number of distinct page paths visited during this session.
2421
+ */
2422
+ pageCount: number;
2423
+ /**
2424
+ * Deep link to the in-app replay viewer for this session. Requires an
2425
+ * authenticated session in the Ours Privacy app for an account that owns this
2426
+ * experiment — not embeddable in customer-facing emails.
2427
+ */
2428
+ replayUrl: string;
2429
+ /**
2430
+ * Session identifier (`dp_sid`). Combine with `visitorId` and the `YYYY-MM-DD`
2431
+ * date of `startTime` to deep-link to a replay outside of the response
2432
+ * `replayUrl`.
2433
+ */
2434
+ sessionId: string;
2435
+ /**
2436
+ * ISO-8601 timestamp of the first event recorded in this session. Sessions are
2437
+ * ordered newest first by this field.
2438
+ */
2439
+ startTime: string;
2440
+ /**
2441
+ * Human-readable name of the variant the visitor was assigned for the recorded
2442
+ * impression. May be empty if the variant has been deleted since the impression
2443
+ * fired.
2444
+ */
2445
+ variantName: string;
2446
+ /**
2447
+ * Visitor identifier whose session is recorded here.
2448
+ */
2449
+ visitorId: string;
2450
+ }
2451
+ interface Pagination {
2452
+ hasMore: boolean;
2453
+ nextCursor?: string | null;
2454
+ }
2455
+ }
2456
+ export interface ExperimentListParams extends CursorParams {
2457
+ /**
2458
+ * Optional case-insensitive text search matched against experiment ID, name, and
2459
+ * description.
2460
+ */
2461
+ search?: string;
2462
+ /**
2463
+ * Optional lifecycle-state filter.
2464
+ */
2465
+ status?: 'completed' | 'draft' | 'paused' | 'running';
2466
+ /**
2467
+ * Optional experiment-type filter.
2468
+ */
2469
+ type?: 'ab' | 'multivariate' | 'personalization';
2470
+ }
2471
+ export interface ExperimentCreateParams {
2472
+ /**
2473
+ * ID of the experiment settings record that owns this experiment. Call
2474
+ * `GET /rest/v1/experiment-settings` first if you need to discover the correct ID
2475
+ * for the current account.
2476
+ */
2477
+ experimentSettingsId: string;
2478
+ /**
2479
+ * Short experiment name.
2480
+ */
2481
+ name: string;
2482
+ /**
2483
+ * Weight of the auto-created control variant, as a percentage (1–100). Defaults to
2484
+ * 100 (a new experiment is all control until treatments are added). The control
2485
+ * must keep at least 1% — a 0% control leaves visitors with no bucket to assign at
2486
+ * runtime. As treatments are added the control is reconciled to the remainder (100
2487
+ * − Σ treatment weights), so it normally does not need to be set explicitly.
2488
+ */
2489
+ controlWeight?: number | null;
2490
+ /**
2491
+ * Optional hypothesis or operator note.
2492
+ */
2493
+ description?: string | null;
2494
+ /**
2495
+ * Whether redirect variants in this experiment should preserve the original
2496
+ * request query string.
2497
+ */
2498
+ includeQueryString?: boolean | null;
2499
+ /**
2500
+ * Optional stable code-facing key. When omitted, the API slugifies the name
2501
+ * automatically.
2502
+ */
2503
+ key?: string | null;
2504
+ /**
2505
+ * Goal events. If you send `metrics.primary`, `metrics.primary.eventName` must be
2506
+ * a non-blank string. A primary event name is required before the experiment can
2507
+ * be started.
2508
+ */
2509
+ metrics?: ExperimentCreateParams.Metrics | null;
2510
+ /**
2511
+ * Eligibility rules — URL patterns, audience, visitor status, query-param
2512
+ * conditions. Omit to inherit defaults.
2513
+ */
2514
+ targetingRules?: ExperimentCreateParams.TargetingRules | null;
2515
+ /**
2516
+ * Initial traffic allocation percentage from 0 to 100.
2517
+ */
2518
+ trafficAllocation?: number | null;
2519
+ /**
2520
+ * Experiment mode to create. `ab` and `multivariate` use traffic allocation and
2521
+ * results; `personalization` is always-on targeting. Omit to create a standard
2522
+ * `ab` experiment.
2523
+ */
2524
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
2525
+ }
2526
+ export declare namespace ExperimentCreateParams {
2527
+ /**
2528
+ * Goal events. If you send `metrics.primary`, `metrics.primary.eventName` must be
2529
+ * a non-blank string. A primary event name is required before the experiment can
2530
+ * be started.
2531
+ */
2532
+ interface Metrics {
2533
+ /**
2534
+ * Primary success metric. When provided, `eventName` must be a non-blank string.
2535
+ */
2536
+ primary?: Metrics.Primary | null;
2537
+ /**
2538
+ * Optional secondary metrics tracked alongside the primary goal.
2539
+ */
2540
+ secondary?: Array<Metrics.Secondary> | null;
2541
+ }
2542
+ namespace Metrics {
2543
+ /**
2544
+ * Primary success metric. When provided, `eventName` must be a non-blank string.
2545
+ */
2546
+ interface Primary {
2547
+ /**
2548
+ * Event name to use as the goal for this metric.
2549
+ */
2550
+ eventName?: string | null;
2551
+ /**
2552
+ * Optional funnel identifier when the metric should be derived from an existing
2553
+ * funnel definition.
2554
+ */
2555
+ funnelId?: string | null;
2556
+ }
2557
+ interface Secondary {
1906
2558
  /**
1907
2559
  * Event name to use as the goal for this metric.
1908
2560
  */
@@ -2121,7 +2773,32 @@ export interface ExperimentStartParams {
2121
2773
  }
2122
2774
  export interface ExperimentStopParams {
2123
2775
  /**
2124
- * Optional winning variant ID to persist when completing the experiment.
2776
+ * Optional variant to roll out to 100% of traffic immediately on stop — the
2777
+ * explicit serving decision that keeps the winning experience live (a winning
2778
+ * redirect becomes an ongoing redirect). Must be a non-control variant. Reverse
2779
+ * later via `POST /experiments/{id}/end-rollout`.
2780
+ */
2781
+ rolloutVariantId?: string;
2782
+ /**
2783
+ * Optional declared winner to record (reporting metadata only — does not change
2784
+ * what visitors are served).
2785
+ */
2786
+ winnerVariantId?: string;
2787
+ }
2788
+ export interface ExperimentRolloutParams {
2789
+ /**
2790
+ * Non-control variant to roll out to 100% of targeted traffic. The runtime keeps
2791
+ * serving it to every matching visitor — a winning redirect becomes an ongoing
2792
+ * redirect. Reverse via `POST /experiments/{id}/end-rollout`. The experiment must
2793
+ * be completed.
2794
+ */
2795
+ variantId: string;
2796
+ }
2797
+ export interface ExperimentWinnerParams {
2798
+ /**
2799
+ * Variant to record as the declared winner (reporting metadata only — does not
2800
+ * change what visitors are served). Omit to clear the declared winner. The
2801
+ * experiment must be completed.
2125
2802
  */
2126
2803
  winnerVariantId?: string;
2127
2804
  }
@@ -2188,6 +2865,6 @@ export interface ExperimentSessionReplaysParams {
2188
2865
  variant_id?: string;
2189
2866
  }
2190
2867
  export declare namespace Experiments {
2191
- export { type ExperimentListResponse as ExperimentListResponse, type ExperimentCreateResponse as ExperimentCreateResponse, type ExperimentRetrieveResponse as ExperimentRetrieveResponse, type ExperimentUpdateResponse as ExperimentUpdateResponse, type ExperimentDeleteResponse as ExperimentDeleteResponse, type ExperimentStartResponse as ExperimentStartResponse, type ExperimentStopResponse as ExperimentStopResponse, type ExperimentPauseResponse as ExperimentPauseResponse, type ExperimentResumeResponse as ExperimentResumeResponse, type ExperimentResultsResponse as ExperimentResultsResponse, type ExperimentResultsTimeSeriesResponse as ExperimentResultsTimeSeriesResponse, type ExperimentSessionReplaysResponse as ExperimentSessionReplaysResponse, type ExperimentListResponsesCursor as ExperimentListResponsesCursor, type ExperimentListParams as ExperimentListParams, type ExperimentCreateParams as ExperimentCreateParams, type ExperimentUpdateParams as ExperimentUpdateParams, type ExperimentStartParams as ExperimentStartParams, type ExperimentStopParams as ExperimentStopParams, type ExperimentPauseParams as ExperimentPauseParams, type ExperimentResumeParams as ExperimentResumeParams, type ExperimentResultsParams as ExperimentResultsParams, type ExperimentResultsTimeSeriesParams as ExperimentResultsTimeSeriesParams, type ExperimentSessionReplaysParams as ExperimentSessionReplaysParams, };
2868
+ export { type ExperimentListResponse as ExperimentListResponse, type ExperimentCreateResponse as ExperimentCreateResponse, type ExperimentRetrieveResponse as ExperimentRetrieveResponse, type ExperimentUpdateResponse as ExperimentUpdateResponse, type ExperimentDeleteResponse as ExperimentDeleteResponse, type ExperimentStartResponse as ExperimentStartResponse, type ExperimentStopResponse as ExperimentStopResponse, type ExperimentRolloutResponse as ExperimentRolloutResponse, type ExperimentEndRolloutResponse as ExperimentEndRolloutResponse, type ExperimentWinnerResponse as ExperimentWinnerResponse, type ExperimentPauseResponse as ExperimentPauseResponse, type ExperimentResumeResponse as ExperimentResumeResponse, type ExperimentResultsResponse as ExperimentResultsResponse, type ExperimentResultsTimeSeriesResponse as ExperimentResultsTimeSeriesResponse, type ExperimentSessionReplaysResponse as ExperimentSessionReplaysResponse, type ExperimentListResponsesCursor as ExperimentListResponsesCursor, type ExperimentListParams as ExperimentListParams, type ExperimentCreateParams as ExperimentCreateParams, type ExperimentUpdateParams as ExperimentUpdateParams, type ExperimentStartParams as ExperimentStartParams, type ExperimentStopParams as ExperimentStopParams, type ExperimentRolloutParams as ExperimentRolloutParams, type ExperimentWinnerParams as ExperimentWinnerParams, type ExperimentPauseParams as ExperimentPauseParams, type ExperimentResumeParams as ExperimentResumeParams, type ExperimentResultsParams as ExperimentResultsParams, type ExperimentResultsTimeSeriesParams as ExperimentResultsTimeSeriesParams, type ExperimentSessionReplaysParams as ExperimentSessionReplaysParams, };
2192
2869
  }
2193
2870
  //# sourceMappingURL=experiments.d.mts.map