@oursprivacy/platform-sdk 1.12.0 → 1.14.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.
- package/CHANGELOG.md +24 -0
- package/README.md +35 -0
- package/client.d.mts +32 -14
- package/client.d.mts.map +1 -1
- package/client.d.ts +32 -14
- package/client.d.ts.map +1 -1
- package/client.js +26 -4
- package/client.js.map +1 -1
- package/client.mjs +26 -4
- package/client.mjs.map +1 -1
- package/core/pagination.d.mts +60 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +60 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +101 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +95 -0
- package/core/pagination.mjs.map +1 -0
- package/index.d.mts +1 -0
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -0
- package/index.mjs.map +1 -1
- package/package.json +11 -1
- package/pagination.d.mts +2 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +2 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +6 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +2 -0
- package/pagination.mjs.map +1 -0
- package/resources/allowed-events.d.mts +18 -18
- package/resources/allowed-events.d.mts.map +1 -1
- package/resources/allowed-events.d.ts +18 -18
- package/resources/allowed-events.d.ts.map +1 -1
- package/resources/allowed-events.js +7 -7
- package/resources/allowed-events.js.map +1 -1
- package/resources/allowed-events.mjs +7 -7
- package/resources/allowed-events.mjs.map +1 -1
- package/resources/consent-settings.d.mts +2568 -124
- package/resources/consent-settings.d.mts.map +1 -1
- package/resources/consent-settings.d.ts +2568 -124
- package/resources/consent-settings.d.ts.map +1 -1
- package/resources/consent-settings.js +24 -7
- package/resources/consent-settings.js.map +1 -1
- package/resources/consent-settings.mjs +24 -7
- package/resources/consent-settings.mjs.map +1 -1
- package/resources/destinations.d.mts +33 -32
- package/resources/destinations.d.mts.map +1 -1
- package/resources/destinations.d.ts +33 -32
- package/resources/destinations.d.ts.map +1 -1
- package/resources/destinations.js +8 -7
- package/resources/destinations.js.map +1 -1
- package/resources/destinations.mjs +8 -7
- package/resources/destinations.mjs.map +1 -1
- package/resources/experiment-settings.d.mts +277 -0
- package/resources/experiment-settings.d.mts.map +1 -0
- package/resources/experiment-settings.d.ts +277 -0
- package/resources/experiment-settings.d.ts.map +1 -0
- package/resources/experiment-settings.js +77 -0
- package/resources/experiment-settings.js.map +1 -0
- package/resources/experiment-settings.mjs +73 -0
- package/resources/experiment-settings.mjs.map +1 -0
- package/resources/experiment-variants.d.mts +653 -0
- package/resources/experiment-variants.d.mts.map +1 -0
- package/resources/experiment-variants.d.ts +653 -0
- package/resources/experiment-variants.d.ts.map +1 -0
- package/resources/experiment-variants.js +86 -0
- package/resources/experiment-variants.js.map +1 -0
- package/resources/experiment-variants.mjs +82 -0
- package/resources/experiment-variants.mjs.map +1 -0
- package/resources/experiments.d.mts +2002 -0
- package/resources/experiments.d.mts.map +1 -0
- package/resources/experiments.d.ts +2002 -0
- package/resources/experiments.d.ts.map +1 -0
- package/resources/experiments.js +166 -0
- package/resources/experiments.js.map +1 -0
- package/resources/experiments.mjs +162 -0
- package/resources/experiments.mjs.map +1 -0
- package/resources/global-dispatch-centers.d.mts +125 -58
- package/resources/global-dispatch-centers.d.mts.map +1 -1
- package/resources/global-dispatch-centers.d.ts +125 -58
- package/resources/global-dispatch-centers.d.ts.map +1 -1
- package/resources/global-dispatch-centers.js +10 -7
- package/resources/global-dispatch-centers.js.map +1 -1
- package/resources/global-dispatch-centers.mjs +10 -7
- package/resources/global-dispatch-centers.mjs.map +1 -1
- package/resources/index.d.mts +11 -7
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +11 -7
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +9 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +4 -0
- package/resources/index.mjs.map +1 -1
- package/resources/mappings.d.mts +138 -0
- package/resources/mappings.d.mts.map +1 -0
- package/resources/mappings.d.ts +138 -0
- package/resources/mappings.d.ts.map +1 -0
- package/resources/mappings.js +45 -0
- package/resources/mappings.js.map +1 -0
- package/resources/mappings.mjs +41 -0
- package/resources/mappings.mjs.map +1 -0
- package/resources/replay-settings.d.mts +48 -48
- package/resources/replay-settings.d.mts.map +1 -1
- package/resources/replay-settings.d.ts +48 -48
- package/resources/replay-settings.d.ts.map +1 -1
- package/resources/replay-settings.js +13 -8
- package/resources/replay-settings.js.map +1 -1
- package/resources/replay-settings.mjs +13 -8
- package/resources/replay-settings.mjs.map +1 -1
- package/resources/sources.d.mts +64 -27
- package/resources/sources.d.mts.map +1 -1
- package/resources/sources.d.ts +64 -27
- package/resources/sources.d.ts.map +1 -1
- package/resources/sources.js +14 -7
- package/resources/sources.js.map +1 -1
- package/resources/sources.mjs +14 -7
- package/resources/sources.mjs.map +1 -1
- package/resources/versions.d.mts +742 -16
- package/resources/versions.d.mts.map +1 -1
- package/resources/versions.d.ts +742 -16
- package/resources/versions.d.ts.map +1 -1
- package/resources/versions.js +45 -5
- package/resources/versions.js.map +1 -1
- package/resources/versions.mjs +45 -5
- package/resources/versions.mjs.map +1 -1
- package/src/client.ts +210 -29
- package/src/core/pagination.ts +165 -0
- package/src/index.ts +1 -0
- package/src/pagination.ts +2 -0
- package/src/resources/allowed-events.ts +27 -27
- package/src/resources/consent-settings.ts +3036 -244
- package/src/resources/destinations.ts +128 -127
- package/src/resources/experiment-settings.ts +367 -0
- package/src/resources/experiment-variants.ts +868 -0
- package/src/resources/experiments.ts +2446 -0
- package/src/resources/global-dispatch-centers.ts +155 -65
- package/src/resources/index.ts +77 -7
- package/src/resources/mappings.ts +236 -0
- package/src/resources/replay-settings.ts +67 -59
- package/src/resources/sources.ts +116 -71
- package/src/resources/versions.ts +1130 -17
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,2002 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../core/api-promise.js";
|
|
3
|
+
import { Cursor, type CursorParams, PagePromise } from "../core/pagination.js";
|
|
4
|
+
import { RequestOptions } from "../internal/request-options.js";
|
|
5
|
+
export declare class Experiments extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* List experiments for this account. Supports cursor pagination and filtering by
|
|
8
|
+
* `status`, `type`, and free-text `search` matched against experiment id, name,
|
|
9
|
+
* and description. Combine filters with AND semantics. Requires scope:
|
|
10
|
+
* experiment:list
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* // Automatically fetches more pages as needed.
|
|
15
|
+
* for await (const experimentListResponse of client.experiments.list()) {
|
|
16
|
+
* // ...
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
list(query?: ExperimentListParams | null | undefined, options?: RequestOptions): PagePromise<ExperimentListResponsesCursor, ExperimentListResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* Create a new experiment. Requires scope: experiment:create
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const experiment = await client.experiments.create({
|
|
27
|
+
* experimentSettingsId:
|
|
28
|
+
* 'settings_01HZX9BB73EY2Q37VGK5A0VW7A',
|
|
29
|
+
* name: 'Homepage Hero Headline Test',
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
create(body: ExperimentCreateParams, options?: RequestOptions): APIPromise<ExperimentCreateResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Find a single experiment by ID. Requires scope: experiment:find
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const experiment = await client.experiments.retrieve('id');
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<ExperimentRetrieveResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* Partially update an experiment. Only the fields you send are changed. Edits are
|
|
45
|
+
* only accepted while the experiment is in `draft` status — running, paused, and
|
|
46
|
+
* completed experiments return 409 with
|
|
47
|
+
* `Experiment can only be edited in draft status`. Use the lifecycle endpoints
|
|
48
|
+
* (`/start`, `/pause`, `/resume`, `/stop`) to change status. Requires scope:
|
|
49
|
+
* experiment:update
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const experiment = await client.experiments.update('id');
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
update(id: string, body: ExperimentUpdateParams, options?: RequestOptions): APIPromise<ExperimentUpdateResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* Delete an experiment. Requires scope: experiment:delete
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* const experiment = await client.experiments.delete('id');
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
delete(id: string, options?: RequestOptions): APIPromise<ExperimentDeleteResponse>;
|
|
66
|
+
/**
|
|
67
|
+
* Start an experiment. The request body is optional — send `{}` to use defaults.
|
|
68
|
+
* Requires scope: experiment:start
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const response = await client.experiments.start('id');
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
start(id: string, body?: ExperimentStartParams | null | undefined, options?: RequestOptions): APIPromise<ExperimentStartResponse>;
|
|
76
|
+
/**
|
|
77
|
+
* Stop an experiment. The request body is optional — send `{}` to stop without
|
|
78
|
+
* recording a winner. Requires scope: experiment:stop
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* const response = await client.experiments.stop('id');
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
stop(id: string, body?: ExperimentStopParams | null | undefined, options?: RequestOptions): APIPromise<ExperimentStopResponse>;
|
|
86
|
+
/**
|
|
87
|
+
* Pause a running experiment. Stops new variant assignments while preserving
|
|
88
|
+
* existing ones; the experiment can later be resumed. The request body is
|
|
89
|
+
* optional. Requires scope: experiment:stop
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const response = await client.experiments.pause('id');
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
pause(id: string, body?: ExperimentPauseParams | null | undefined, options?: RequestOptions): APIPromise<ExperimentPauseResponse>;
|
|
97
|
+
/**
|
|
98
|
+
* Resume a previously-paused experiment so new visitors can be assigned again. The
|
|
99
|
+
* request body is optional. Requires scope: experiment:start
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* const response = await client.experiments.resume('id');
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
resume(id: string, body?: ExperimentResumeParams | null | undefined, options?: RequestOptions): APIPromise<ExperimentResumeResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Aggregate per-variant impressions, conversions, conversion rate, and Bayesian
|
|
109
|
+
* probability-to-be-best across the experiment runtime window. Requires scope:
|
|
110
|
+
* experiment:find
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* const response = await client.experiments.results('id');
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
results(id: string, query?: ExperimentResultsParams | null | undefined, options?: RequestOptions): APIPromise<ExperimentResultsResponse>;
|
|
118
|
+
/**
|
|
119
|
+
* Per-day per-variant impressions, conversions, and conversion rate, sliced to a
|
|
120
|
+
* date range. Use this to chart trends, compare windows, or zoom in on a specific
|
|
121
|
+
* period. Pass `startDate` / `endDate` (`YYYY-MM-DD`, UTC, both inclusive) to set
|
|
122
|
+
* the window; both default to the full experiment runtime when omitted, so the
|
|
123
|
+
* no-arg call returns every day from start to today (or to `stoppedAt` for
|
|
124
|
+
* completed experiments). The response orders days oldest-first and omits days
|
|
125
|
+
* with no impressions, so an empty `days` array means there was no measured
|
|
126
|
+
* traffic in the window. Requires scope: experiment:find
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* const response = await client.experiments.resultsTimeSeries(
|
|
131
|
+
* 'id',
|
|
132
|
+
* );
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
resultsTimeSeries(id: string, query?: ExperimentResultsTimeSeriesParams | null | undefined, options?: RequestOptions): APIPromise<ExperimentResultsTimeSeriesResponse>;
|
|
136
|
+
}
|
|
137
|
+
export type ExperimentListResponsesCursor = Cursor<ExperimentListResponse>;
|
|
138
|
+
export interface ExperimentListResponse {
|
|
139
|
+
/**
|
|
140
|
+
* Unique identifier for the experiment.
|
|
141
|
+
*/
|
|
142
|
+
id: string;
|
|
143
|
+
/**
|
|
144
|
+
* ISO-8601 timestamp when the experiment was created.
|
|
145
|
+
*/
|
|
146
|
+
createdAt: string;
|
|
147
|
+
/**
|
|
148
|
+
* Stable code-facing key for the experiment. Use this with the headless SDK
|
|
149
|
+
* `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
|
|
150
|
+
* application code.
|
|
151
|
+
*/
|
|
152
|
+
key: string;
|
|
153
|
+
/**
|
|
154
|
+
* Short, human-readable experiment name.
|
|
155
|
+
*/
|
|
156
|
+
name: string;
|
|
157
|
+
/**
|
|
158
|
+
* Lifecycle state. `draft` is editable, `running` is active, `paused` is
|
|
159
|
+
* temporarily inactive, and `completed` is permanently stopped.
|
|
160
|
+
*/
|
|
161
|
+
status: 'completed' | 'draft' | 'paused' | 'running';
|
|
162
|
+
/**
|
|
163
|
+
* Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
|
|
164
|
+
* enrollment without deleting the experiment.
|
|
165
|
+
*/
|
|
166
|
+
trafficAllocation: number;
|
|
167
|
+
/**
|
|
168
|
+
* Optional human-readable hypothesis or summary. In GraphQL this is backed by the
|
|
169
|
+
* experiment hypothesis field.
|
|
170
|
+
*/
|
|
171
|
+
description?: string | null;
|
|
172
|
+
/**
|
|
173
|
+
* For redirect variants, whether the original page query string should be
|
|
174
|
+
* forwarded onto the redirect URL.
|
|
175
|
+
*/
|
|
176
|
+
includeQueryString?: boolean | null;
|
|
177
|
+
/**
|
|
178
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
179
|
+
* from a GET response can be PATCHed back without modification.
|
|
180
|
+
*/
|
|
181
|
+
metrics?: ExperimentListResponse.Metrics | null;
|
|
182
|
+
/**
|
|
183
|
+
* ISO-8601 timestamp when the experiment most recently entered a running state.
|
|
184
|
+
*/
|
|
185
|
+
startedAt?: string | null;
|
|
186
|
+
/**
|
|
187
|
+
* ISO-8601 timestamp when the experiment was completed, if it has been stopped.
|
|
188
|
+
*/
|
|
189
|
+
stoppedAt?: string | null;
|
|
190
|
+
/**
|
|
191
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
192
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
193
|
+
* create/patch input.
|
|
194
|
+
*/
|
|
195
|
+
targetingRules?: ExperimentListResponse.TargetingRules | null;
|
|
196
|
+
/**
|
|
197
|
+
* Experiment mode. `ab` and `multivariate` use traffic allocation and results;
|
|
198
|
+
* `personalization` is always-on targeting.
|
|
199
|
+
*/
|
|
200
|
+
type?: 'ab' | 'multivariate' | 'personalization' | null;
|
|
201
|
+
/**
|
|
202
|
+
* ISO-8601 timestamp for the last persisted update, if any.
|
|
203
|
+
*/
|
|
204
|
+
updatedAt?: string | null;
|
|
205
|
+
/**
|
|
206
|
+
* Variant ID persisted as the winner when the experiment was stopped. Set via
|
|
207
|
+
* `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
|
|
208
|
+
*/
|
|
209
|
+
winnerVariantId?: string | null;
|
|
210
|
+
}
|
|
211
|
+
export declare namespace ExperimentListResponse {
|
|
212
|
+
/**
|
|
213
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
214
|
+
* from a GET response can be PATCHed back without modification.
|
|
215
|
+
*/
|
|
216
|
+
interface Metrics {
|
|
217
|
+
/**
|
|
218
|
+
* Primary success metric used in the results report.
|
|
219
|
+
*/
|
|
220
|
+
primary?: unknown | null;
|
|
221
|
+
/**
|
|
222
|
+
* Optional secondary metrics tracked alongside the primary goal.
|
|
223
|
+
*/
|
|
224
|
+
secondary?: Array<Metrics.Secondary> | null;
|
|
225
|
+
}
|
|
226
|
+
namespace Metrics {
|
|
227
|
+
interface Secondary {
|
|
228
|
+
/**
|
|
229
|
+
* Name of the event used to measure success for this metric.
|
|
230
|
+
*/
|
|
231
|
+
eventName?: string | null;
|
|
232
|
+
/**
|
|
233
|
+
* Optional funnel identifier when the metric is derived from an existing funnel
|
|
234
|
+
* definition.
|
|
235
|
+
*/
|
|
236
|
+
funnelId?: string | null;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
241
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
242
|
+
* create/patch input.
|
|
243
|
+
*/
|
|
244
|
+
interface TargetingRules {
|
|
245
|
+
/**
|
|
246
|
+
* Glob-style URL patterns that must match for the experiment to be eligible. Up to
|
|
247
|
+
* 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
|
|
248
|
+
* the field) matches all URLs — equivalent to `["**"]`.
|
|
249
|
+
*/
|
|
250
|
+
urlPatterns: Array<string>;
|
|
251
|
+
/**
|
|
252
|
+
* Optional audience identifier used for server-side eligibility filtering.
|
|
253
|
+
*/
|
|
254
|
+
audienceId?: string | null;
|
|
255
|
+
/**
|
|
256
|
+
* Additional query-string conditions that must all match for the visitor to
|
|
257
|
+
* qualify.
|
|
258
|
+
*/
|
|
259
|
+
queryParams?: Array<TargetingRules.QueryParam> | null;
|
|
260
|
+
/**
|
|
261
|
+
* Optional visitor-property matching rules. These are passed through as JSON for
|
|
262
|
+
* experimentation targeting.
|
|
263
|
+
*/
|
|
264
|
+
visitorProperties?: unknown | null;
|
|
265
|
+
/**
|
|
266
|
+
* Whether the experiment should target new visitors, returning visitors, or any
|
|
267
|
+
* visitor.
|
|
268
|
+
*/
|
|
269
|
+
visitorStatus?: string | null;
|
|
270
|
+
}
|
|
271
|
+
namespace TargetingRules {
|
|
272
|
+
interface QueryParam {
|
|
273
|
+
/**
|
|
274
|
+
* Query string key to inspect on the current page URL.
|
|
275
|
+
*/
|
|
276
|
+
key: string;
|
|
277
|
+
/**
|
|
278
|
+
* Comparison operator applied to the query string value.
|
|
279
|
+
*/
|
|
280
|
+
operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
|
|
281
|
+
/**
|
|
282
|
+
* Comparison value used by operators that require one. Omit for `exists` and
|
|
283
|
+
* `not_exists`.
|
|
284
|
+
*/
|
|
285
|
+
value?: string | null;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
export interface ExperimentCreateResponse {
|
|
290
|
+
/**
|
|
291
|
+
* Unique identifier for the experiment.
|
|
292
|
+
*/
|
|
293
|
+
id: string;
|
|
294
|
+
/**
|
|
295
|
+
* ISO-8601 timestamp when the experiment was created.
|
|
296
|
+
*/
|
|
297
|
+
createdAt: string;
|
|
298
|
+
/**
|
|
299
|
+
* Stable code-facing key for the experiment. Use this with the headless SDK
|
|
300
|
+
* `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
|
|
301
|
+
* application code.
|
|
302
|
+
*/
|
|
303
|
+
key: string;
|
|
304
|
+
/**
|
|
305
|
+
* Short, human-readable experiment name.
|
|
306
|
+
*/
|
|
307
|
+
name: string;
|
|
308
|
+
/**
|
|
309
|
+
* Lifecycle state. `draft` is editable, `running` is active, `paused` is
|
|
310
|
+
* temporarily inactive, and `completed` is permanently stopped.
|
|
311
|
+
*/
|
|
312
|
+
status: 'completed' | 'draft' | 'paused' | 'running';
|
|
313
|
+
/**
|
|
314
|
+
* Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
|
|
315
|
+
* enrollment without deleting the experiment.
|
|
316
|
+
*/
|
|
317
|
+
trafficAllocation: number;
|
|
318
|
+
/**
|
|
319
|
+
* All persisted variants for this experiment, including the control variant. A
|
|
320
|
+
* non-personalization experiment needs at least two variants before it can be
|
|
321
|
+
* started.
|
|
322
|
+
*/
|
|
323
|
+
variants: Array<ExperimentCreateResponse.Variant>;
|
|
324
|
+
/**
|
|
325
|
+
* Optional human-readable hypothesis or summary. In GraphQL this is backed by the
|
|
326
|
+
* experiment hypothesis field.
|
|
327
|
+
*/
|
|
328
|
+
description?: string | null;
|
|
329
|
+
/**
|
|
330
|
+
* For redirect variants, whether the original page query string should be
|
|
331
|
+
* forwarded onto the redirect URL.
|
|
332
|
+
*/
|
|
333
|
+
includeQueryString?: boolean | null;
|
|
334
|
+
/**
|
|
335
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
336
|
+
* from a GET response can be PATCHed back without modification.
|
|
337
|
+
*/
|
|
338
|
+
metrics?: ExperimentCreateResponse.Metrics | null;
|
|
339
|
+
/**
|
|
340
|
+
* ISO-8601 timestamp when the experiment most recently entered a running state.
|
|
341
|
+
*/
|
|
342
|
+
startedAt?: string | null;
|
|
343
|
+
/**
|
|
344
|
+
* ISO-8601 timestamp when the experiment was completed, if it has been stopped.
|
|
345
|
+
*/
|
|
346
|
+
stoppedAt?: string | null;
|
|
347
|
+
/**
|
|
348
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
349
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
350
|
+
* create/patch input.
|
|
351
|
+
*/
|
|
352
|
+
targetingRules?: ExperimentCreateResponse.TargetingRules | null;
|
|
353
|
+
/**
|
|
354
|
+
* Experiment mode. `ab` and `multivariate` use traffic allocation and results;
|
|
355
|
+
* `personalization` is always-on targeting.
|
|
356
|
+
*/
|
|
357
|
+
type?: 'ab' | 'multivariate' | 'personalization' | null;
|
|
358
|
+
/**
|
|
359
|
+
* ISO-8601 timestamp for the last persisted update, if any.
|
|
360
|
+
*/
|
|
361
|
+
updatedAt?: string | null;
|
|
362
|
+
/**
|
|
363
|
+
* Variant ID persisted as the winner when the experiment was stopped. Set via
|
|
364
|
+
* `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
|
|
365
|
+
*/
|
|
366
|
+
winnerVariantId?: string | null;
|
|
367
|
+
}
|
|
368
|
+
export declare namespace ExperimentCreateResponse {
|
|
369
|
+
interface Variant {
|
|
370
|
+
/**
|
|
371
|
+
* Unique identifier for this experiment variant.
|
|
372
|
+
*/
|
|
373
|
+
id: string;
|
|
374
|
+
/**
|
|
375
|
+
* Parent experiment ID this variant belongs to.
|
|
376
|
+
*/
|
|
377
|
+
experimentId: string;
|
|
378
|
+
/**
|
|
379
|
+
* Whether this is the baseline control variant.
|
|
380
|
+
*/
|
|
381
|
+
isControl: boolean;
|
|
382
|
+
/**
|
|
383
|
+
* Human-readable variant name shown in the dashboard and results.
|
|
384
|
+
*/
|
|
385
|
+
name: string;
|
|
386
|
+
/**
|
|
387
|
+
* Relative traffic weight used when assigning visitors among variants in an active
|
|
388
|
+
* experiment.
|
|
389
|
+
*/
|
|
390
|
+
weight: number;
|
|
391
|
+
/**
|
|
392
|
+
* Ordered list of declarative DOM mutations applied when this variant is assigned.
|
|
393
|
+
*/
|
|
394
|
+
domModifications?: Array<Variant.DomModification> | null;
|
|
395
|
+
/**
|
|
396
|
+
* Target URL for redirect variants. Use either a site-relative path such as
|
|
397
|
+
* `/pricing-v2` or an absolute `https://` URL. Cross-origin `http://` URLs are
|
|
398
|
+
* rejected. Omit for DOM modification variants.
|
|
399
|
+
*/
|
|
400
|
+
redirectUrl?: string | null;
|
|
401
|
+
/**
|
|
402
|
+
* How this variant changes the user experience. `dom_modifications` for on-page
|
|
403
|
+
* changes or `redirect` for redirect tests.
|
|
404
|
+
*/
|
|
405
|
+
variantType?: string | null;
|
|
406
|
+
}
|
|
407
|
+
namespace Variant {
|
|
408
|
+
interface DomModification {
|
|
409
|
+
/**
|
|
410
|
+
* Mutation to apply when the selector matches. Use `redirectUrl` instead of DOM
|
|
411
|
+
* modifications for redirect variants.
|
|
412
|
+
*/
|
|
413
|
+
action: 'customCss' | 'customJs' | 'insertAfter' | 'insertBefore' | 'remove' | 'setAttribute' | 'setHtml' | 'setImage' | 'setStyle' | 'setText';
|
|
414
|
+
/**
|
|
415
|
+
* CSS selector used to find the element to modify on the page at runtime.
|
|
416
|
+
*/
|
|
417
|
+
selector: string;
|
|
418
|
+
/**
|
|
419
|
+
* Canonical action payload. For `setText` / `setHtml` / `customCss` / `customJs` /
|
|
420
|
+
* `setImage` / `insertBefore` / `insertAfter` this is the literal
|
|
421
|
+
* text/HTML/CSS/JS/URL. For `setStyle` and `setAttribute` it is a JSON-stringified
|
|
422
|
+
* `{key: value}` object — prefer the structured `styles` / `attribute` fields
|
|
423
|
+
* below to avoid manual JSON encoding.
|
|
424
|
+
*/
|
|
425
|
+
value: string;
|
|
426
|
+
/**
|
|
427
|
+
* Populated on read for `setAttribute` modifications, parsed from `value`.
|
|
428
|
+
* Customers may also send this field instead of a JSON-stringified `value` on
|
|
429
|
+
* write — see `domModificationInputSchema`.
|
|
430
|
+
*/
|
|
431
|
+
attribute?: unknown | null;
|
|
432
|
+
/**
|
|
433
|
+
* Populated on read for `setStyle` modifications, parsed from `value`. Customers
|
|
434
|
+
* may also send this field instead of a JSON-stringified `value` on write — see
|
|
435
|
+
* `domModificationInputSchema`.
|
|
436
|
+
*/
|
|
437
|
+
styles?: Array<DomModification.Style> | null;
|
|
438
|
+
}
|
|
439
|
+
namespace DomModification {
|
|
440
|
+
interface Style {
|
|
441
|
+
/**
|
|
442
|
+
* CSS property name in camelCase or kebab-case.
|
|
443
|
+
*/
|
|
444
|
+
property: string;
|
|
445
|
+
/**
|
|
446
|
+
* CSS value to assign to the property.
|
|
447
|
+
*/
|
|
448
|
+
value: string;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
454
|
+
* from a GET response can be PATCHed back without modification.
|
|
455
|
+
*/
|
|
456
|
+
interface Metrics {
|
|
457
|
+
/**
|
|
458
|
+
* Primary success metric used in the results report.
|
|
459
|
+
*/
|
|
460
|
+
primary?: unknown | null;
|
|
461
|
+
/**
|
|
462
|
+
* Optional secondary metrics tracked alongside the primary goal.
|
|
463
|
+
*/
|
|
464
|
+
secondary?: Array<Metrics.Secondary> | null;
|
|
465
|
+
}
|
|
466
|
+
namespace Metrics {
|
|
467
|
+
interface Secondary {
|
|
468
|
+
/**
|
|
469
|
+
* Name of the event used to measure success for this metric.
|
|
470
|
+
*/
|
|
471
|
+
eventName?: string | null;
|
|
472
|
+
/**
|
|
473
|
+
* Optional funnel identifier when the metric is derived from an existing funnel
|
|
474
|
+
* definition.
|
|
475
|
+
*/
|
|
476
|
+
funnelId?: string | null;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
481
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
482
|
+
* create/patch input.
|
|
483
|
+
*/
|
|
484
|
+
interface TargetingRules {
|
|
485
|
+
/**
|
|
486
|
+
* Glob-style URL patterns that must match for the experiment to be eligible. Up to
|
|
487
|
+
* 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
|
|
488
|
+
* the field) matches all URLs — equivalent to `["**"]`.
|
|
489
|
+
*/
|
|
490
|
+
urlPatterns: Array<string>;
|
|
491
|
+
/**
|
|
492
|
+
* Optional audience identifier used for server-side eligibility filtering.
|
|
493
|
+
*/
|
|
494
|
+
audienceId?: string | null;
|
|
495
|
+
/**
|
|
496
|
+
* Additional query-string conditions that must all match for the visitor to
|
|
497
|
+
* qualify.
|
|
498
|
+
*/
|
|
499
|
+
queryParams?: Array<TargetingRules.QueryParam> | null;
|
|
500
|
+
/**
|
|
501
|
+
* Optional visitor-property matching rules. These are passed through as JSON for
|
|
502
|
+
* experimentation targeting.
|
|
503
|
+
*/
|
|
504
|
+
visitorProperties?: unknown | null;
|
|
505
|
+
/**
|
|
506
|
+
* Whether the experiment should target new visitors, returning visitors, or any
|
|
507
|
+
* visitor.
|
|
508
|
+
*/
|
|
509
|
+
visitorStatus?: string | null;
|
|
510
|
+
}
|
|
511
|
+
namespace TargetingRules {
|
|
512
|
+
interface QueryParam {
|
|
513
|
+
/**
|
|
514
|
+
* Query string key to inspect on the current page URL.
|
|
515
|
+
*/
|
|
516
|
+
key: string;
|
|
517
|
+
/**
|
|
518
|
+
* Comparison operator applied to the query string value.
|
|
519
|
+
*/
|
|
520
|
+
operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
|
|
521
|
+
/**
|
|
522
|
+
* Comparison value used by operators that require one. Omit for `exists` and
|
|
523
|
+
* `not_exists`.
|
|
524
|
+
*/
|
|
525
|
+
value?: string | null;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
export interface ExperimentRetrieveResponse {
|
|
530
|
+
/**
|
|
531
|
+
* Unique identifier for the experiment.
|
|
532
|
+
*/
|
|
533
|
+
id: string;
|
|
534
|
+
/**
|
|
535
|
+
* ISO-8601 timestamp when the experiment was created.
|
|
536
|
+
*/
|
|
537
|
+
createdAt: string;
|
|
538
|
+
/**
|
|
539
|
+
* Stable code-facing key for the experiment. Use this with the headless SDK
|
|
540
|
+
* `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
|
|
541
|
+
* application code.
|
|
542
|
+
*/
|
|
543
|
+
key: string;
|
|
544
|
+
/**
|
|
545
|
+
* Short, human-readable experiment name.
|
|
546
|
+
*/
|
|
547
|
+
name: string;
|
|
548
|
+
/**
|
|
549
|
+
* Lifecycle state. `draft` is editable, `running` is active, `paused` is
|
|
550
|
+
* temporarily inactive, and `completed` is permanently stopped.
|
|
551
|
+
*/
|
|
552
|
+
status: 'completed' | 'draft' | 'paused' | 'running';
|
|
553
|
+
/**
|
|
554
|
+
* Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
|
|
555
|
+
* enrollment without deleting the experiment.
|
|
556
|
+
*/
|
|
557
|
+
trafficAllocation: number;
|
|
558
|
+
/**
|
|
559
|
+
* All persisted variants for this experiment, including the control variant. A
|
|
560
|
+
* non-personalization experiment needs at least two variants before it can be
|
|
561
|
+
* started.
|
|
562
|
+
*/
|
|
563
|
+
variants: Array<ExperimentRetrieveResponse.Variant>;
|
|
564
|
+
/**
|
|
565
|
+
* Optional human-readable hypothesis or summary. In GraphQL this is backed by the
|
|
566
|
+
* experiment hypothesis field.
|
|
567
|
+
*/
|
|
568
|
+
description?: string | null;
|
|
569
|
+
/**
|
|
570
|
+
* For redirect variants, whether the original page query string should be
|
|
571
|
+
* forwarded onto the redirect URL.
|
|
572
|
+
*/
|
|
573
|
+
includeQueryString?: boolean | null;
|
|
574
|
+
/**
|
|
575
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
576
|
+
* from a GET response can be PATCHed back without modification.
|
|
577
|
+
*/
|
|
578
|
+
metrics?: ExperimentRetrieveResponse.Metrics | null;
|
|
579
|
+
/**
|
|
580
|
+
* ISO-8601 timestamp when the experiment most recently entered a running state.
|
|
581
|
+
*/
|
|
582
|
+
startedAt?: string | null;
|
|
583
|
+
/**
|
|
584
|
+
* ISO-8601 timestamp when the experiment was completed, if it has been stopped.
|
|
585
|
+
*/
|
|
586
|
+
stoppedAt?: string | null;
|
|
587
|
+
/**
|
|
588
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
589
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
590
|
+
* create/patch input.
|
|
591
|
+
*/
|
|
592
|
+
targetingRules?: ExperimentRetrieveResponse.TargetingRules | null;
|
|
593
|
+
/**
|
|
594
|
+
* Experiment mode. `ab` and `multivariate` use traffic allocation and results;
|
|
595
|
+
* `personalization` is always-on targeting.
|
|
596
|
+
*/
|
|
597
|
+
type?: 'ab' | 'multivariate' | 'personalization' | null;
|
|
598
|
+
/**
|
|
599
|
+
* ISO-8601 timestamp for the last persisted update, if any.
|
|
600
|
+
*/
|
|
601
|
+
updatedAt?: string | null;
|
|
602
|
+
/**
|
|
603
|
+
* Variant ID persisted as the winner when the experiment was stopped. Set via
|
|
604
|
+
* `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
|
|
605
|
+
*/
|
|
606
|
+
winnerVariantId?: string | null;
|
|
607
|
+
}
|
|
608
|
+
export declare namespace ExperimentRetrieveResponse {
|
|
609
|
+
interface Variant {
|
|
610
|
+
/**
|
|
611
|
+
* Unique identifier for this experiment variant.
|
|
612
|
+
*/
|
|
613
|
+
id: string;
|
|
614
|
+
/**
|
|
615
|
+
* Parent experiment ID this variant belongs to.
|
|
616
|
+
*/
|
|
617
|
+
experimentId: string;
|
|
618
|
+
/**
|
|
619
|
+
* Whether this is the baseline control variant.
|
|
620
|
+
*/
|
|
621
|
+
isControl: boolean;
|
|
622
|
+
/**
|
|
623
|
+
* Human-readable variant name shown in the dashboard and results.
|
|
624
|
+
*/
|
|
625
|
+
name: string;
|
|
626
|
+
/**
|
|
627
|
+
* Relative traffic weight used when assigning visitors among variants in an active
|
|
628
|
+
* experiment.
|
|
629
|
+
*/
|
|
630
|
+
weight: number;
|
|
631
|
+
/**
|
|
632
|
+
* Ordered list of declarative DOM mutations applied when this variant is assigned.
|
|
633
|
+
*/
|
|
634
|
+
domModifications?: Array<Variant.DomModification> | null;
|
|
635
|
+
/**
|
|
636
|
+
* Target URL for redirect variants. Use either a site-relative path such as
|
|
637
|
+
* `/pricing-v2` or an absolute `https://` URL. Cross-origin `http://` URLs are
|
|
638
|
+
* rejected. Omit for DOM modification variants.
|
|
639
|
+
*/
|
|
640
|
+
redirectUrl?: string | null;
|
|
641
|
+
/**
|
|
642
|
+
* How this variant changes the user experience. `dom_modifications` for on-page
|
|
643
|
+
* changes or `redirect` for redirect tests.
|
|
644
|
+
*/
|
|
645
|
+
variantType?: string | null;
|
|
646
|
+
}
|
|
647
|
+
namespace Variant {
|
|
648
|
+
interface DomModification {
|
|
649
|
+
/**
|
|
650
|
+
* Mutation to apply when the selector matches. Use `redirectUrl` instead of DOM
|
|
651
|
+
* modifications for redirect variants.
|
|
652
|
+
*/
|
|
653
|
+
action: 'customCss' | 'customJs' | 'insertAfter' | 'insertBefore' | 'remove' | 'setAttribute' | 'setHtml' | 'setImage' | 'setStyle' | 'setText';
|
|
654
|
+
/**
|
|
655
|
+
* CSS selector used to find the element to modify on the page at runtime.
|
|
656
|
+
*/
|
|
657
|
+
selector: string;
|
|
658
|
+
/**
|
|
659
|
+
* Canonical action payload. For `setText` / `setHtml` / `customCss` / `customJs` /
|
|
660
|
+
* `setImage` / `insertBefore` / `insertAfter` this is the literal
|
|
661
|
+
* text/HTML/CSS/JS/URL. For `setStyle` and `setAttribute` it is a JSON-stringified
|
|
662
|
+
* `{key: value}` object — prefer the structured `styles` / `attribute` fields
|
|
663
|
+
* below to avoid manual JSON encoding.
|
|
664
|
+
*/
|
|
665
|
+
value: string;
|
|
666
|
+
/**
|
|
667
|
+
* Populated on read for `setAttribute` modifications, parsed from `value`.
|
|
668
|
+
* Customers may also send this field instead of a JSON-stringified `value` on
|
|
669
|
+
* write — see `domModificationInputSchema`.
|
|
670
|
+
*/
|
|
671
|
+
attribute?: unknown | null;
|
|
672
|
+
/**
|
|
673
|
+
* Populated on read for `setStyle` modifications, parsed from `value`. Customers
|
|
674
|
+
* may also send this field instead of a JSON-stringified `value` on write — see
|
|
675
|
+
* `domModificationInputSchema`.
|
|
676
|
+
*/
|
|
677
|
+
styles?: Array<DomModification.Style> | null;
|
|
678
|
+
}
|
|
679
|
+
namespace DomModification {
|
|
680
|
+
interface Style {
|
|
681
|
+
/**
|
|
682
|
+
* CSS property name in camelCase or kebab-case.
|
|
683
|
+
*/
|
|
684
|
+
property: string;
|
|
685
|
+
/**
|
|
686
|
+
* CSS value to assign to the property.
|
|
687
|
+
*/
|
|
688
|
+
value: string;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
694
|
+
* from a GET response can be PATCHed back without modification.
|
|
695
|
+
*/
|
|
696
|
+
interface Metrics {
|
|
697
|
+
/**
|
|
698
|
+
* Primary success metric used in the results report.
|
|
699
|
+
*/
|
|
700
|
+
primary?: unknown | null;
|
|
701
|
+
/**
|
|
702
|
+
* Optional secondary metrics tracked alongside the primary goal.
|
|
703
|
+
*/
|
|
704
|
+
secondary?: Array<Metrics.Secondary> | null;
|
|
705
|
+
}
|
|
706
|
+
namespace Metrics {
|
|
707
|
+
interface Secondary {
|
|
708
|
+
/**
|
|
709
|
+
* Name of the event used to measure success for this metric.
|
|
710
|
+
*/
|
|
711
|
+
eventName?: string | null;
|
|
712
|
+
/**
|
|
713
|
+
* Optional funnel identifier when the metric is derived from an existing funnel
|
|
714
|
+
* definition.
|
|
715
|
+
*/
|
|
716
|
+
funnelId?: string | null;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
721
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
722
|
+
* create/patch input.
|
|
723
|
+
*/
|
|
724
|
+
interface TargetingRules {
|
|
725
|
+
/**
|
|
726
|
+
* Glob-style URL patterns that must match for the experiment to be eligible. Up to
|
|
727
|
+
* 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
|
|
728
|
+
* the field) matches all URLs — equivalent to `["**"]`.
|
|
729
|
+
*/
|
|
730
|
+
urlPatterns: Array<string>;
|
|
731
|
+
/**
|
|
732
|
+
* Optional audience identifier used for server-side eligibility filtering.
|
|
733
|
+
*/
|
|
734
|
+
audienceId?: string | null;
|
|
735
|
+
/**
|
|
736
|
+
* Additional query-string conditions that must all match for the visitor to
|
|
737
|
+
* qualify.
|
|
738
|
+
*/
|
|
739
|
+
queryParams?: Array<TargetingRules.QueryParam> | null;
|
|
740
|
+
/**
|
|
741
|
+
* Optional visitor-property matching rules. These are passed through as JSON for
|
|
742
|
+
* experimentation targeting.
|
|
743
|
+
*/
|
|
744
|
+
visitorProperties?: unknown | null;
|
|
745
|
+
/**
|
|
746
|
+
* Whether the experiment should target new visitors, returning visitors, or any
|
|
747
|
+
* visitor.
|
|
748
|
+
*/
|
|
749
|
+
visitorStatus?: string | null;
|
|
750
|
+
}
|
|
751
|
+
namespace TargetingRules {
|
|
752
|
+
interface QueryParam {
|
|
753
|
+
/**
|
|
754
|
+
* Query string key to inspect on the current page URL.
|
|
755
|
+
*/
|
|
756
|
+
key: string;
|
|
757
|
+
/**
|
|
758
|
+
* Comparison operator applied to the query string value.
|
|
759
|
+
*/
|
|
760
|
+
operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
|
|
761
|
+
/**
|
|
762
|
+
* Comparison value used by operators that require one. Omit for `exists` and
|
|
763
|
+
* `not_exists`.
|
|
764
|
+
*/
|
|
765
|
+
value?: string | null;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
export interface ExperimentUpdateResponse {
|
|
770
|
+
/**
|
|
771
|
+
* Unique identifier for the experiment.
|
|
772
|
+
*/
|
|
773
|
+
id: string;
|
|
774
|
+
/**
|
|
775
|
+
* ISO-8601 timestamp when the experiment was created.
|
|
776
|
+
*/
|
|
777
|
+
createdAt: string;
|
|
778
|
+
/**
|
|
779
|
+
* Stable code-facing key for the experiment. Use this with the headless SDK
|
|
780
|
+
* `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
|
|
781
|
+
* application code.
|
|
782
|
+
*/
|
|
783
|
+
key: string;
|
|
784
|
+
/**
|
|
785
|
+
* Short, human-readable experiment name.
|
|
786
|
+
*/
|
|
787
|
+
name: string;
|
|
788
|
+
/**
|
|
789
|
+
* Lifecycle state. `draft` is editable, `running` is active, `paused` is
|
|
790
|
+
* temporarily inactive, and `completed` is permanently stopped.
|
|
791
|
+
*/
|
|
792
|
+
status: 'completed' | 'draft' | 'paused' | 'running';
|
|
793
|
+
/**
|
|
794
|
+
* Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
|
|
795
|
+
* enrollment without deleting the experiment.
|
|
796
|
+
*/
|
|
797
|
+
trafficAllocation: number;
|
|
798
|
+
/**
|
|
799
|
+
* Optional human-readable hypothesis or summary. In GraphQL this is backed by the
|
|
800
|
+
* experiment hypothesis field.
|
|
801
|
+
*/
|
|
802
|
+
description?: string | null;
|
|
803
|
+
/**
|
|
804
|
+
* For redirect variants, whether the original page query string should be
|
|
805
|
+
* forwarded onto the redirect URL.
|
|
806
|
+
*/
|
|
807
|
+
includeQueryString?: boolean | null;
|
|
808
|
+
/**
|
|
809
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
810
|
+
* from a GET response can be PATCHed back without modification.
|
|
811
|
+
*/
|
|
812
|
+
metrics?: ExperimentUpdateResponse.Metrics | null;
|
|
813
|
+
/**
|
|
814
|
+
* ISO-8601 timestamp when the experiment most recently entered a running state.
|
|
815
|
+
*/
|
|
816
|
+
startedAt?: string | null;
|
|
817
|
+
/**
|
|
818
|
+
* ISO-8601 timestamp when the experiment was completed, if it has been stopped.
|
|
819
|
+
*/
|
|
820
|
+
stoppedAt?: string | null;
|
|
821
|
+
/**
|
|
822
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
823
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
824
|
+
* create/patch input.
|
|
825
|
+
*/
|
|
826
|
+
targetingRules?: ExperimentUpdateResponse.TargetingRules | null;
|
|
827
|
+
/**
|
|
828
|
+
* Experiment mode. `ab` and `multivariate` use traffic allocation and results;
|
|
829
|
+
* `personalization` is always-on targeting.
|
|
830
|
+
*/
|
|
831
|
+
type?: 'ab' | 'multivariate' | 'personalization' | null;
|
|
832
|
+
/**
|
|
833
|
+
* ISO-8601 timestamp for the last persisted update, if any.
|
|
834
|
+
*/
|
|
835
|
+
updatedAt?: string | null;
|
|
836
|
+
/**
|
|
837
|
+
* Variant ID persisted as the winner when the experiment was stopped. Set via
|
|
838
|
+
* `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
|
|
839
|
+
*/
|
|
840
|
+
winnerVariantId?: string | null;
|
|
841
|
+
}
|
|
842
|
+
export declare namespace ExperimentUpdateResponse {
|
|
843
|
+
/**
|
|
844
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
845
|
+
* from a GET response can be PATCHed back without modification.
|
|
846
|
+
*/
|
|
847
|
+
interface Metrics {
|
|
848
|
+
/**
|
|
849
|
+
* Primary success metric used in the results report.
|
|
850
|
+
*/
|
|
851
|
+
primary?: unknown | null;
|
|
852
|
+
/**
|
|
853
|
+
* Optional secondary metrics tracked alongside the primary goal.
|
|
854
|
+
*/
|
|
855
|
+
secondary?: Array<Metrics.Secondary> | null;
|
|
856
|
+
}
|
|
857
|
+
namespace Metrics {
|
|
858
|
+
interface Secondary {
|
|
859
|
+
/**
|
|
860
|
+
* Name of the event used to measure success for this metric.
|
|
861
|
+
*/
|
|
862
|
+
eventName?: string | null;
|
|
863
|
+
/**
|
|
864
|
+
* Optional funnel identifier when the metric is derived from an existing funnel
|
|
865
|
+
* definition.
|
|
866
|
+
*/
|
|
867
|
+
funnelId?: string | null;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
872
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
873
|
+
* create/patch input.
|
|
874
|
+
*/
|
|
875
|
+
interface TargetingRules {
|
|
876
|
+
/**
|
|
877
|
+
* Glob-style URL patterns that must match for the experiment to be eligible. Up to
|
|
878
|
+
* 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
|
|
879
|
+
* the field) matches all URLs — equivalent to `["**"]`.
|
|
880
|
+
*/
|
|
881
|
+
urlPatterns: Array<string>;
|
|
882
|
+
/**
|
|
883
|
+
* Optional audience identifier used for server-side eligibility filtering.
|
|
884
|
+
*/
|
|
885
|
+
audienceId?: string | null;
|
|
886
|
+
/**
|
|
887
|
+
* Additional query-string conditions that must all match for the visitor to
|
|
888
|
+
* qualify.
|
|
889
|
+
*/
|
|
890
|
+
queryParams?: Array<TargetingRules.QueryParam> | null;
|
|
891
|
+
/**
|
|
892
|
+
* Optional visitor-property matching rules. These are passed through as JSON for
|
|
893
|
+
* experimentation targeting.
|
|
894
|
+
*/
|
|
895
|
+
visitorProperties?: unknown | null;
|
|
896
|
+
/**
|
|
897
|
+
* Whether the experiment should target new visitors, returning visitors, or any
|
|
898
|
+
* visitor.
|
|
899
|
+
*/
|
|
900
|
+
visitorStatus?: string | null;
|
|
901
|
+
}
|
|
902
|
+
namespace TargetingRules {
|
|
903
|
+
interface QueryParam {
|
|
904
|
+
/**
|
|
905
|
+
* Query string key to inspect on the current page URL.
|
|
906
|
+
*/
|
|
907
|
+
key: string;
|
|
908
|
+
/**
|
|
909
|
+
* Comparison operator applied to the query string value.
|
|
910
|
+
*/
|
|
911
|
+
operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
|
|
912
|
+
/**
|
|
913
|
+
* Comparison value used by operators that require one. Omit for `exists` and
|
|
914
|
+
* `not_exists`.
|
|
915
|
+
*/
|
|
916
|
+
value?: string | null;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Whether the experiment was deleted successfully.
|
|
922
|
+
*/
|
|
923
|
+
export type ExperimentDeleteResponse = boolean;
|
|
924
|
+
export interface ExperimentStartResponse {
|
|
925
|
+
/**
|
|
926
|
+
* Number of unpublished version changes detected at the time of the lifecycle
|
|
927
|
+
* action. Values greater than 1 mean other unpublished work exists besides this
|
|
928
|
+
* experiment state change.
|
|
929
|
+
*/
|
|
930
|
+
concurrentVersionChanges: number;
|
|
931
|
+
experiment: ExperimentStartResponse.Experiment;
|
|
932
|
+
/**
|
|
933
|
+
* Whether the status change was also published to the current live version
|
|
934
|
+
* immediately.
|
|
935
|
+
*/
|
|
936
|
+
publishStatus: 'pending_publish' | 'published';
|
|
937
|
+
}
|
|
938
|
+
export declare namespace ExperimentStartResponse {
|
|
939
|
+
interface Experiment {
|
|
940
|
+
/**
|
|
941
|
+
* Unique identifier for the experiment.
|
|
942
|
+
*/
|
|
943
|
+
id: string;
|
|
944
|
+
/**
|
|
945
|
+
* ISO-8601 timestamp when the experiment was created.
|
|
946
|
+
*/
|
|
947
|
+
createdAt: string;
|
|
948
|
+
/**
|
|
949
|
+
* Stable code-facing key for the experiment. Use this with the headless SDK
|
|
950
|
+
* `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
|
|
951
|
+
* application code.
|
|
952
|
+
*/
|
|
953
|
+
key: string;
|
|
954
|
+
/**
|
|
955
|
+
* Short, human-readable experiment name.
|
|
956
|
+
*/
|
|
957
|
+
name: string;
|
|
958
|
+
/**
|
|
959
|
+
* Lifecycle state. `draft` is editable, `running` is active, `paused` is
|
|
960
|
+
* temporarily inactive, and `completed` is permanently stopped.
|
|
961
|
+
*/
|
|
962
|
+
status: 'completed' | 'draft' | 'paused' | 'running';
|
|
963
|
+
/**
|
|
964
|
+
* Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
|
|
965
|
+
* enrollment without deleting the experiment.
|
|
966
|
+
*/
|
|
967
|
+
trafficAllocation: number;
|
|
968
|
+
/**
|
|
969
|
+
* Optional human-readable hypothesis or summary. In GraphQL this is backed by the
|
|
970
|
+
* experiment hypothesis field.
|
|
971
|
+
*/
|
|
972
|
+
description?: string | null;
|
|
973
|
+
/**
|
|
974
|
+
* For redirect variants, whether the original page query string should be
|
|
975
|
+
* forwarded onto the redirect URL.
|
|
976
|
+
*/
|
|
977
|
+
includeQueryString?: boolean | null;
|
|
978
|
+
/**
|
|
979
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
980
|
+
* from a GET response can be PATCHed back without modification.
|
|
981
|
+
*/
|
|
982
|
+
metrics?: Experiment.Metrics | null;
|
|
983
|
+
/**
|
|
984
|
+
* ISO-8601 timestamp when the experiment most recently entered a running state.
|
|
985
|
+
*/
|
|
986
|
+
startedAt?: string | null;
|
|
987
|
+
/**
|
|
988
|
+
* ISO-8601 timestamp when the experiment was completed, if it has been stopped.
|
|
989
|
+
*/
|
|
990
|
+
stoppedAt?: string | null;
|
|
991
|
+
/**
|
|
992
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
993
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
994
|
+
* create/patch input.
|
|
995
|
+
*/
|
|
996
|
+
targetingRules?: Experiment.TargetingRules | null;
|
|
997
|
+
/**
|
|
998
|
+
* Experiment mode. `ab` and `multivariate` use traffic allocation and results;
|
|
999
|
+
* `personalization` is always-on targeting.
|
|
1000
|
+
*/
|
|
1001
|
+
type?: 'ab' | 'multivariate' | 'personalization' | null;
|
|
1002
|
+
/**
|
|
1003
|
+
* ISO-8601 timestamp for the last persisted update, if any.
|
|
1004
|
+
*/
|
|
1005
|
+
updatedAt?: string | null;
|
|
1006
|
+
/**
|
|
1007
|
+
* Variant ID persisted as the winner when the experiment was stopped. Set via
|
|
1008
|
+
* `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
|
|
1009
|
+
*/
|
|
1010
|
+
winnerVariantId?: string | null;
|
|
1011
|
+
}
|
|
1012
|
+
namespace Experiment {
|
|
1013
|
+
/**
|
|
1014
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
1015
|
+
* from a GET response can be PATCHed back without modification.
|
|
1016
|
+
*/
|
|
1017
|
+
interface Metrics {
|
|
1018
|
+
/**
|
|
1019
|
+
* Primary success metric used in the results report.
|
|
1020
|
+
*/
|
|
1021
|
+
primary?: unknown | null;
|
|
1022
|
+
/**
|
|
1023
|
+
* Optional secondary metrics tracked alongside the primary goal.
|
|
1024
|
+
*/
|
|
1025
|
+
secondary?: Array<Metrics.Secondary> | null;
|
|
1026
|
+
}
|
|
1027
|
+
namespace Metrics {
|
|
1028
|
+
interface Secondary {
|
|
1029
|
+
/**
|
|
1030
|
+
* Name of the event used to measure success for this metric.
|
|
1031
|
+
*/
|
|
1032
|
+
eventName?: string | null;
|
|
1033
|
+
/**
|
|
1034
|
+
* Optional funnel identifier when the metric is derived from an existing funnel
|
|
1035
|
+
* definition.
|
|
1036
|
+
*/
|
|
1037
|
+
funnelId?: string | null;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
1042
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
1043
|
+
* create/patch input.
|
|
1044
|
+
*/
|
|
1045
|
+
interface TargetingRules {
|
|
1046
|
+
/**
|
|
1047
|
+
* Glob-style URL patterns that must match for the experiment to be eligible. Up to
|
|
1048
|
+
* 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
|
|
1049
|
+
* the field) matches all URLs — equivalent to `["**"]`.
|
|
1050
|
+
*/
|
|
1051
|
+
urlPatterns: Array<string>;
|
|
1052
|
+
/**
|
|
1053
|
+
* Optional audience identifier used for server-side eligibility filtering.
|
|
1054
|
+
*/
|
|
1055
|
+
audienceId?: string | null;
|
|
1056
|
+
/**
|
|
1057
|
+
* Additional query-string conditions that must all match for the visitor to
|
|
1058
|
+
* qualify.
|
|
1059
|
+
*/
|
|
1060
|
+
queryParams?: Array<TargetingRules.QueryParam> | null;
|
|
1061
|
+
/**
|
|
1062
|
+
* Optional visitor-property matching rules. These are passed through as JSON for
|
|
1063
|
+
* experimentation targeting.
|
|
1064
|
+
*/
|
|
1065
|
+
visitorProperties?: unknown | null;
|
|
1066
|
+
/**
|
|
1067
|
+
* Whether the experiment should target new visitors, returning visitors, or any
|
|
1068
|
+
* visitor.
|
|
1069
|
+
*/
|
|
1070
|
+
visitorStatus?: string | null;
|
|
1071
|
+
}
|
|
1072
|
+
namespace TargetingRules {
|
|
1073
|
+
interface QueryParam {
|
|
1074
|
+
/**
|
|
1075
|
+
* Query string key to inspect on the current page URL.
|
|
1076
|
+
*/
|
|
1077
|
+
key: string;
|
|
1078
|
+
/**
|
|
1079
|
+
* Comparison operator applied to the query string value.
|
|
1080
|
+
*/
|
|
1081
|
+
operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
|
|
1082
|
+
/**
|
|
1083
|
+
* Comparison value used by operators that require one. Omit for `exists` and
|
|
1084
|
+
* `not_exists`.
|
|
1085
|
+
*/
|
|
1086
|
+
value?: string | null;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
export interface ExperimentStopResponse {
|
|
1092
|
+
/**
|
|
1093
|
+
* Number of unpublished version changes detected at the time of the lifecycle
|
|
1094
|
+
* action. Values greater than 1 mean other unpublished work exists besides this
|
|
1095
|
+
* experiment state change.
|
|
1096
|
+
*/
|
|
1097
|
+
concurrentVersionChanges: number;
|
|
1098
|
+
experiment: ExperimentStopResponse.Experiment;
|
|
1099
|
+
/**
|
|
1100
|
+
* Whether the status change was also published to the current live version
|
|
1101
|
+
* immediately.
|
|
1102
|
+
*/
|
|
1103
|
+
publishStatus: 'pending_publish' | 'published';
|
|
1104
|
+
}
|
|
1105
|
+
export declare namespace ExperimentStopResponse {
|
|
1106
|
+
interface Experiment {
|
|
1107
|
+
/**
|
|
1108
|
+
* Unique identifier for the experiment.
|
|
1109
|
+
*/
|
|
1110
|
+
id: string;
|
|
1111
|
+
/**
|
|
1112
|
+
* ISO-8601 timestamp when the experiment was created.
|
|
1113
|
+
*/
|
|
1114
|
+
createdAt: string;
|
|
1115
|
+
/**
|
|
1116
|
+
* Stable code-facing key for the experiment. Use this with the headless SDK
|
|
1117
|
+
* `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
|
|
1118
|
+
* application code.
|
|
1119
|
+
*/
|
|
1120
|
+
key: string;
|
|
1121
|
+
/**
|
|
1122
|
+
* Short, human-readable experiment name.
|
|
1123
|
+
*/
|
|
1124
|
+
name: string;
|
|
1125
|
+
/**
|
|
1126
|
+
* Lifecycle state. `draft` is editable, `running` is active, `paused` is
|
|
1127
|
+
* temporarily inactive, and `completed` is permanently stopped.
|
|
1128
|
+
*/
|
|
1129
|
+
status: 'completed' | 'draft' | 'paused' | 'running';
|
|
1130
|
+
/**
|
|
1131
|
+
* Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
|
|
1132
|
+
* enrollment without deleting the experiment.
|
|
1133
|
+
*/
|
|
1134
|
+
trafficAllocation: number;
|
|
1135
|
+
/**
|
|
1136
|
+
* Optional human-readable hypothesis or summary. In GraphQL this is backed by the
|
|
1137
|
+
* experiment hypothesis field.
|
|
1138
|
+
*/
|
|
1139
|
+
description?: string | null;
|
|
1140
|
+
/**
|
|
1141
|
+
* For redirect variants, whether the original page query string should be
|
|
1142
|
+
* forwarded onto the redirect URL.
|
|
1143
|
+
*/
|
|
1144
|
+
includeQueryString?: boolean | null;
|
|
1145
|
+
/**
|
|
1146
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
1147
|
+
* from a GET response can be PATCHed back without modification.
|
|
1148
|
+
*/
|
|
1149
|
+
metrics?: Experiment.Metrics | null;
|
|
1150
|
+
/**
|
|
1151
|
+
* ISO-8601 timestamp when the experiment most recently entered a running state.
|
|
1152
|
+
*/
|
|
1153
|
+
startedAt?: string | null;
|
|
1154
|
+
/**
|
|
1155
|
+
* ISO-8601 timestamp when the experiment was completed, if it has been stopped.
|
|
1156
|
+
*/
|
|
1157
|
+
stoppedAt?: string | null;
|
|
1158
|
+
/**
|
|
1159
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
1160
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
1161
|
+
* create/patch input.
|
|
1162
|
+
*/
|
|
1163
|
+
targetingRules?: Experiment.TargetingRules | null;
|
|
1164
|
+
/**
|
|
1165
|
+
* Experiment mode. `ab` and `multivariate` use traffic allocation and results;
|
|
1166
|
+
* `personalization` is always-on targeting.
|
|
1167
|
+
*/
|
|
1168
|
+
type?: 'ab' | 'multivariate' | 'personalization' | null;
|
|
1169
|
+
/**
|
|
1170
|
+
* ISO-8601 timestamp for the last persisted update, if any.
|
|
1171
|
+
*/
|
|
1172
|
+
updatedAt?: string | null;
|
|
1173
|
+
/**
|
|
1174
|
+
* Variant ID persisted as the winner when the experiment was stopped. Set via
|
|
1175
|
+
* `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
|
|
1176
|
+
*/
|
|
1177
|
+
winnerVariantId?: string | null;
|
|
1178
|
+
}
|
|
1179
|
+
namespace Experiment {
|
|
1180
|
+
/**
|
|
1181
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
1182
|
+
* from a GET response can be PATCHed back without modification.
|
|
1183
|
+
*/
|
|
1184
|
+
interface Metrics {
|
|
1185
|
+
/**
|
|
1186
|
+
* Primary success metric used in the results report.
|
|
1187
|
+
*/
|
|
1188
|
+
primary?: unknown | null;
|
|
1189
|
+
/**
|
|
1190
|
+
* Optional secondary metrics tracked alongside the primary goal.
|
|
1191
|
+
*/
|
|
1192
|
+
secondary?: Array<Metrics.Secondary> | null;
|
|
1193
|
+
}
|
|
1194
|
+
namespace Metrics {
|
|
1195
|
+
interface Secondary {
|
|
1196
|
+
/**
|
|
1197
|
+
* Name of the event used to measure success for this metric.
|
|
1198
|
+
*/
|
|
1199
|
+
eventName?: string | null;
|
|
1200
|
+
/**
|
|
1201
|
+
* Optional funnel identifier when the metric is derived from an existing funnel
|
|
1202
|
+
* definition.
|
|
1203
|
+
*/
|
|
1204
|
+
funnelId?: string | null;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
1209
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
1210
|
+
* create/patch input.
|
|
1211
|
+
*/
|
|
1212
|
+
interface TargetingRules {
|
|
1213
|
+
/**
|
|
1214
|
+
* Glob-style URL patterns that must match for the experiment to be eligible. Up to
|
|
1215
|
+
* 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
|
|
1216
|
+
* the field) matches all URLs — equivalent to `["**"]`.
|
|
1217
|
+
*/
|
|
1218
|
+
urlPatterns: Array<string>;
|
|
1219
|
+
/**
|
|
1220
|
+
* Optional audience identifier used for server-side eligibility filtering.
|
|
1221
|
+
*/
|
|
1222
|
+
audienceId?: string | null;
|
|
1223
|
+
/**
|
|
1224
|
+
* Additional query-string conditions that must all match for the visitor to
|
|
1225
|
+
* qualify.
|
|
1226
|
+
*/
|
|
1227
|
+
queryParams?: Array<TargetingRules.QueryParam> | null;
|
|
1228
|
+
/**
|
|
1229
|
+
* Optional visitor-property matching rules. These are passed through as JSON for
|
|
1230
|
+
* experimentation targeting.
|
|
1231
|
+
*/
|
|
1232
|
+
visitorProperties?: unknown | null;
|
|
1233
|
+
/**
|
|
1234
|
+
* Whether the experiment should target new visitors, returning visitors, or any
|
|
1235
|
+
* visitor.
|
|
1236
|
+
*/
|
|
1237
|
+
visitorStatus?: string | null;
|
|
1238
|
+
}
|
|
1239
|
+
namespace TargetingRules {
|
|
1240
|
+
interface QueryParam {
|
|
1241
|
+
/**
|
|
1242
|
+
* Query string key to inspect on the current page URL.
|
|
1243
|
+
*/
|
|
1244
|
+
key: string;
|
|
1245
|
+
/**
|
|
1246
|
+
* Comparison operator applied to the query string value.
|
|
1247
|
+
*/
|
|
1248
|
+
operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
|
|
1249
|
+
/**
|
|
1250
|
+
* Comparison value used by operators that require one. Omit for `exists` and
|
|
1251
|
+
* `not_exists`.
|
|
1252
|
+
*/
|
|
1253
|
+
value?: string | null;
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
export interface ExperimentPauseResponse {
|
|
1259
|
+
/**
|
|
1260
|
+
* Number of unpublished version changes detected at the time of the lifecycle
|
|
1261
|
+
* action. Values greater than 1 mean other unpublished work exists besides this
|
|
1262
|
+
* experiment state change.
|
|
1263
|
+
*/
|
|
1264
|
+
concurrentVersionChanges: number;
|
|
1265
|
+
experiment: ExperimentPauseResponse.Experiment;
|
|
1266
|
+
/**
|
|
1267
|
+
* Whether the status change was also published to the current live version
|
|
1268
|
+
* immediately.
|
|
1269
|
+
*/
|
|
1270
|
+
publishStatus: 'pending_publish' | 'published';
|
|
1271
|
+
}
|
|
1272
|
+
export declare namespace ExperimentPauseResponse {
|
|
1273
|
+
interface Experiment {
|
|
1274
|
+
/**
|
|
1275
|
+
* Unique identifier for the experiment.
|
|
1276
|
+
*/
|
|
1277
|
+
id: string;
|
|
1278
|
+
/**
|
|
1279
|
+
* ISO-8601 timestamp when the experiment was created.
|
|
1280
|
+
*/
|
|
1281
|
+
createdAt: string;
|
|
1282
|
+
/**
|
|
1283
|
+
* Stable code-facing key for the experiment. Use this with the headless SDK
|
|
1284
|
+
* `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
|
|
1285
|
+
* application code.
|
|
1286
|
+
*/
|
|
1287
|
+
key: string;
|
|
1288
|
+
/**
|
|
1289
|
+
* Short, human-readable experiment name.
|
|
1290
|
+
*/
|
|
1291
|
+
name: string;
|
|
1292
|
+
/**
|
|
1293
|
+
* Lifecycle state. `draft` is editable, `running` is active, `paused` is
|
|
1294
|
+
* temporarily inactive, and `completed` is permanently stopped.
|
|
1295
|
+
*/
|
|
1296
|
+
status: 'completed' | 'draft' | 'paused' | 'running';
|
|
1297
|
+
/**
|
|
1298
|
+
* Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
|
|
1299
|
+
* enrollment without deleting the experiment.
|
|
1300
|
+
*/
|
|
1301
|
+
trafficAllocation: number;
|
|
1302
|
+
/**
|
|
1303
|
+
* Optional human-readable hypothesis or summary. In GraphQL this is backed by the
|
|
1304
|
+
* experiment hypothesis field.
|
|
1305
|
+
*/
|
|
1306
|
+
description?: string | null;
|
|
1307
|
+
/**
|
|
1308
|
+
* For redirect variants, whether the original page query string should be
|
|
1309
|
+
* forwarded onto the redirect URL.
|
|
1310
|
+
*/
|
|
1311
|
+
includeQueryString?: boolean | null;
|
|
1312
|
+
/**
|
|
1313
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
1314
|
+
* from a GET response can be PATCHed back without modification.
|
|
1315
|
+
*/
|
|
1316
|
+
metrics?: Experiment.Metrics | null;
|
|
1317
|
+
/**
|
|
1318
|
+
* ISO-8601 timestamp when the experiment most recently entered a running state.
|
|
1319
|
+
*/
|
|
1320
|
+
startedAt?: string | null;
|
|
1321
|
+
/**
|
|
1322
|
+
* ISO-8601 timestamp when the experiment was completed, if it has been stopped.
|
|
1323
|
+
*/
|
|
1324
|
+
stoppedAt?: string | null;
|
|
1325
|
+
/**
|
|
1326
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
1327
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
1328
|
+
* create/patch input.
|
|
1329
|
+
*/
|
|
1330
|
+
targetingRules?: Experiment.TargetingRules | null;
|
|
1331
|
+
/**
|
|
1332
|
+
* Experiment mode. `ab` and `multivariate` use traffic allocation and results;
|
|
1333
|
+
* `personalization` is always-on targeting.
|
|
1334
|
+
*/
|
|
1335
|
+
type?: 'ab' | 'multivariate' | 'personalization' | null;
|
|
1336
|
+
/**
|
|
1337
|
+
* ISO-8601 timestamp for the last persisted update, if any.
|
|
1338
|
+
*/
|
|
1339
|
+
updatedAt?: string | null;
|
|
1340
|
+
/**
|
|
1341
|
+
* Variant ID persisted as the winner when the experiment was stopped. Set via
|
|
1342
|
+
* `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
|
|
1343
|
+
*/
|
|
1344
|
+
winnerVariantId?: string | null;
|
|
1345
|
+
}
|
|
1346
|
+
namespace Experiment {
|
|
1347
|
+
/**
|
|
1348
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
1349
|
+
* from a GET response can be PATCHed back without modification.
|
|
1350
|
+
*/
|
|
1351
|
+
interface Metrics {
|
|
1352
|
+
/**
|
|
1353
|
+
* Primary success metric used in the results report.
|
|
1354
|
+
*/
|
|
1355
|
+
primary?: unknown | null;
|
|
1356
|
+
/**
|
|
1357
|
+
* Optional secondary metrics tracked alongside the primary goal.
|
|
1358
|
+
*/
|
|
1359
|
+
secondary?: Array<Metrics.Secondary> | null;
|
|
1360
|
+
}
|
|
1361
|
+
namespace Metrics {
|
|
1362
|
+
interface Secondary {
|
|
1363
|
+
/**
|
|
1364
|
+
* Name of the event used to measure success for this metric.
|
|
1365
|
+
*/
|
|
1366
|
+
eventName?: string | null;
|
|
1367
|
+
/**
|
|
1368
|
+
* Optional funnel identifier when the metric is derived from an existing funnel
|
|
1369
|
+
* definition.
|
|
1370
|
+
*/
|
|
1371
|
+
funnelId?: string | null;
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
1376
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
1377
|
+
* create/patch input.
|
|
1378
|
+
*/
|
|
1379
|
+
interface TargetingRules {
|
|
1380
|
+
/**
|
|
1381
|
+
* Glob-style URL patterns that must match for the experiment to be eligible. Up to
|
|
1382
|
+
* 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
|
|
1383
|
+
* the field) matches all URLs — equivalent to `["**"]`.
|
|
1384
|
+
*/
|
|
1385
|
+
urlPatterns: Array<string>;
|
|
1386
|
+
/**
|
|
1387
|
+
* Optional audience identifier used for server-side eligibility filtering.
|
|
1388
|
+
*/
|
|
1389
|
+
audienceId?: string | null;
|
|
1390
|
+
/**
|
|
1391
|
+
* Additional query-string conditions that must all match for the visitor to
|
|
1392
|
+
* qualify.
|
|
1393
|
+
*/
|
|
1394
|
+
queryParams?: Array<TargetingRules.QueryParam> | null;
|
|
1395
|
+
/**
|
|
1396
|
+
* Optional visitor-property matching rules. These are passed through as JSON for
|
|
1397
|
+
* experimentation targeting.
|
|
1398
|
+
*/
|
|
1399
|
+
visitorProperties?: unknown | null;
|
|
1400
|
+
/**
|
|
1401
|
+
* Whether the experiment should target new visitors, returning visitors, or any
|
|
1402
|
+
* visitor.
|
|
1403
|
+
*/
|
|
1404
|
+
visitorStatus?: string | null;
|
|
1405
|
+
}
|
|
1406
|
+
namespace TargetingRules {
|
|
1407
|
+
interface QueryParam {
|
|
1408
|
+
/**
|
|
1409
|
+
* Query string key to inspect on the current page URL.
|
|
1410
|
+
*/
|
|
1411
|
+
key: string;
|
|
1412
|
+
/**
|
|
1413
|
+
* Comparison operator applied to the query string value.
|
|
1414
|
+
*/
|
|
1415
|
+
operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
|
|
1416
|
+
/**
|
|
1417
|
+
* Comparison value used by operators that require one. Omit for `exists` and
|
|
1418
|
+
* `not_exists`.
|
|
1419
|
+
*/
|
|
1420
|
+
value?: string | null;
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
export interface ExperimentResumeResponse {
|
|
1426
|
+
/**
|
|
1427
|
+
* Number of unpublished version changes detected at the time of the lifecycle
|
|
1428
|
+
* action. Values greater than 1 mean other unpublished work exists besides this
|
|
1429
|
+
* experiment state change.
|
|
1430
|
+
*/
|
|
1431
|
+
concurrentVersionChanges: number;
|
|
1432
|
+
experiment: ExperimentResumeResponse.Experiment;
|
|
1433
|
+
/**
|
|
1434
|
+
* Whether the status change was also published to the current live version
|
|
1435
|
+
* immediately.
|
|
1436
|
+
*/
|
|
1437
|
+
publishStatus: 'pending_publish' | 'published';
|
|
1438
|
+
}
|
|
1439
|
+
export declare namespace ExperimentResumeResponse {
|
|
1440
|
+
interface Experiment {
|
|
1441
|
+
/**
|
|
1442
|
+
* Unique identifier for the experiment.
|
|
1443
|
+
*/
|
|
1444
|
+
id: string;
|
|
1445
|
+
/**
|
|
1446
|
+
* ISO-8601 timestamp when the experiment was created.
|
|
1447
|
+
*/
|
|
1448
|
+
createdAt: string;
|
|
1449
|
+
/**
|
|
1450
|
+
* Stable code-facing key for the experiment. Use this with the headless SDK
|
|
1451
|
+
* `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
|
|
1452
|
+
* application code.
|
|
1453
|
+
*/
|
|
1454
|
+
key: string;
|
|
1455
|
+
/**
|
|
1456
|
+
* Short, human-readable experiment name.
|
|
1457
|
+
*/
|
|
1458
|
+
name: string;
|
|
1459
|
+
/**
|
|
1460
|
+
* Lifecycle state. `draft` is editable, `running` is active, `paused` is
|
|
1461
|
+
* temporarily inactive, and `completed` is permanently stopped.
|
|
1462
|
+
*/
|
|
1463
|
+
status: 'completed' | 'draft' | 'paused' | 'running';
|
|
1464
|
+
/**
|
|
1465
|
+
* Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
|
|
1466
|
+
* enrollment without deleting the experiment.
|
|
1467
|
+
*/
|
|
1468
|
+
trafficAllocation: number;
|
|
1469
|
+
/**
|
|
1470
|
+
* Optional human-readable hypothesis or summary. In GraphQL this is backed by the
|
|
1471
|
+
* experiment hypothesis field.
|
|
1472
|
+
*/
|
|
1473
|
+
description?: string | null;
|
|
1474
|
+
/**
|
|
1475
|
+
* For redirect variants, whether the original page query string should be
|
|
1476
|
+
* forwarded onto the redirect URL.
|
|
1477
|
+
*/
|
|
1478
|
+
includeQueryString?: boolean | null;
|
|
1479
|
+
/**
|
|
1480
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
1481
|
+
* from a GET response can be PATCHed back without modification.
|
|
1482
|
+
*/
|
|
1483
|
+
metrics?: Experiment.Metrics | null;
|
|
1484
|
+
/**
|
|
1485
|
+
* ISO-8601 timestamp when the experiment most recently entered a running state.
|
|
1486
|
+
*/
|
|
1487
|
+
startedAt?: string | null;
|
|
1488
|
+
/**
|
|
1489
|
+
* ISO-8601 timestamp when the experiment was completed, if it has been stopped.
|
|
1490
|
+
*/
|
|
1491
|
+
stoppedAt?: string | null;
|
|
1492
|
+
/**
|
|
1493
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
1494
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
1495
|
+
* create/patch input.
|
|
1496
|
+
*/
|
|
1497
|
+
targetingRules?: Experiment.TargetingRules | null;
|
|
1498
|
+
/**
|
|
1499
|
+
* Experiment mode. `ab` and `multivariate` use traffic allocation and results;
|
|
1500
|
+
* `personalization` is always-on targeting.
|
|
1501
|
+
*/
|
|
1502
|
+
type?: 'ab' | 'multivariate' | 'personalization' | null;
|
|
1503
|
+
/**
|
|
1504
|
+
* ISO-8601 timestamp for the last persisted update, if any.
|
|
1505
|
+
*/
|
|
1506
|
+
updatedAt?: string | null;
|
|
1507
|
+
/**
|
|
1508
|
+
* Variant ID persisted as the winner when the experiment was stopped. Set via
|
|
1509
|
+
* `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
|
|
1510
|
+
*/
|
|
1511
|
+
winnerVariantId?: string | null;
|
|
1512
|
+
}
|
|
1513
|
+
namespace Experiment {
|
|
1514
|
+
/**
|
|
1515
|
+
* Configured success metrics. The read shape mirrors the write shape — `metrics`
|
|
1516
|
+
* from a GET response can be PATCHed back without modification.
|
|
1517
|
+
*/
|
|
1518
|
+
interface Metrics {
|
|
1519
|
+
/**
|
|
1520
|
+
* Primary success metric used in the results report.
|
|
1521
|
+
*/
|
|
1522
|
+
primary?: unknown | null;
|
|
1523
|
+
/**
|
|
1524
|
+
* Optional secondary metrics tracked alongside the primary goal.
|
|
1525
|
+
*/
|
|
1526
|
+
secondary?: Array<Metrics.Secondary> | null;
|
|
1527
|
+
}
|
|
1528
|
+
namespace Metrics {
|
|
1529
|
+
interface Secondary {
|
|
1530
|
+
/**
|
|
1531
|
+
* Name of the event used to measure success for this metric.
|
|
1532
|
+
*/
|
|
1533
|
+
eventName?: string | null;
|
|
1534
|
+
/**
|
|
1535
|
+
* Optional funnel identifier when the metric is derived from an existing funnel
|
|
1536
|
+
* definition.
|
|
1537
|
+
*/
|
|
1538
|
+
funnelId?: string | null;
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
/**
|
|
1542
|
+
* Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
|
|
1543
|
+
* visitor status, and (server-side) visitor properties. Same shape as the
|
|
1544
|
+
* create/patch input.
|
|
1545
|
+
*/
|
|
1546
|
+
interface TargetingRules {
|
|
1547
|
+
/**
|
|
1548
|
+
* Glob-style URL patterns that must match for the experiment to be eligible. Up to
|
|
1549
|
+
* 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
|
|
1550
|
+
* the field) matches all URLs — equivalent to `["**"]`.
|
|
1551
|
+
*/
|
|
1552
|
+
urlPatterns: Array<string>;
|
|
1553
|
+
/**
|
|
1554
|
+
* Optional audience identifier used for server-side eligibility filtering.
|
|
1555
|
+
*/
|
|
1556
|
+
audienceId?: string | null;
|
|
1557
|
+
/**
|
|
1558
|
+
* Additional query-string conditions that must all match for the visitor to
|
|
1559
|
+
* qualify.
|
|
1560
|
+
*/
|
|
1561
|
+
queryParams?: Array<TargetingRules.QueryParam> | null;
|
|
1562
|
+
/**
|
|
1563
|
+
* Optional visitor-property matching rules. These are passed through as JSON for
|
|
1564
|
+
* experimentation targeting.
|
|
1565
|
+
*/
|
|
1566
|
+
visitorProperties?: unknown | null;
|
|
1567
|
+
/**
|
|
1568
|
+
* Whether the experiment should target new visitors, returning visitors, or any
|
|
1569
|
+
* visitor.
|
|
1570
|
+
*/
|
|
1571
|
+
visitorStatus?: string | null;
|
|
1572
|
+
}
|
|
1573
|
+
namespace TargetingRules {
|
|
1574
|
+
interface QueryParam {
|
|
1575
|
+
/**
|
|
1576
|
+
* Query string key to inspect on the current page URL.
|
|
1577
|
+
*/
|
|
1578
|
+
key: string;
|
|
1579
|
+
/**
|
|
1580
|
+
* Comparison operator applied to the query string value.
|
|
1581
|
+
*/
|
|
1582
|
+
operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
|
|
1583
|
+
/**
|
|
1584
|
+
* Comparison value used by operators that require one. Omit for `exists` and
|
|
1585
|
+
* `not_exists`.
|
|
1586
|
+
*/
|
|
1587
|
+
value?: string | null;
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
export interface ExperimentResultsResponse {
|
|
1593
|
+
/**
|
|
1594
|
+
* Aggregate performance metrics for each variant in the experiment over the
|
|
1595
|
+
* experiment runtime window.
|
|
1596
|
+
*/
|
|
1597
|
+
variants: Array<ExperimentResultsResponse.Variant>;
|
|
1598
|
+
}
|
|
1599
|
+
export declare namespace ExperimentResultsResponse {
|
|
1600
|
+
interface Variant {
|
|
1601
|
+
/**
|
|
1602
|
+
* Variant ID this result row belongs to.
|
|
1603
|
+
*/
|
|
1604
|
+
id: string;
|
|
1605
|
+
/**
|
|
1606
|
+
* Conversions divided by impressions for this variant.
|
|
1607
|
+
*/
|
|
1608
|
+
conversionRate: number;
|
|
1609
|
+
/**
|
|
1610
|
+
* Number of post-exposure conversions attributed to the variant.
|
|
1611
|
+
*/
|
|
1612
|
+
conversions: number;
|
|
1613
|
+
/**
|
|
1614
|
+
* Number of distinct experiment-impression events counted for the variant.
|
|
1615
|
+
*/
|
|
1616
|
+
impressions: number;
|
|
1617
|
+
/**
|
|
1618
|
+
* Whether this variant is the experiment control. Exactly one variant per
|
|
1619
|
+
* experiment is the control.
|
|
1620
|
+
*/
|
|
1621
|
+
isControl: boolean;
|
|
1622
|
+
/**
|
|
1623
|
+
* Human-readable variant name as configured on the experiment (e.g. `Control`,
|
|
1624
|
+
* `Treatment`). Lets callers label results without a separate lookup against
|
|
1625
|
+
* `/experiment-variants`.
|
|
1626
|
+
*/
|
|
1627
|
+
name: string;
|
|
1628
|
+
/**
|
|
1629
|
+
* Bayesian probability that this variant is the best-performing option among all
|
|
1630
|
+
* variants in the experiment.
|
|
1631
|
+
*/
|
|
1632
|
+
probabilityToBeBest: number;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
export interface ExperimentResultsTimeSeriesResponse {
|
|
1636
|
+
/**
|
|
1637
|
+
* Per-day metrics for each variant. Days with no impression rows are omitted from
|
|
1638
|
+
* the response.
|
|
1639
|
+
*/
|
|
1640
|
+
days: Array<ExperimentResultsTimeSeriesResponse.Day>;
|
|
1641
|
+
}
|
|
1642
|
+
export declare namespace ExperimentResultsTimeSeriesResponse {
|
|
1643
|
+
interface Day {
|
|
1644
|
+
/**
|
|
1645
|
+
* UTC calendar day in `YYYY-MM-DD` format.
|
|
1646
|
+
*/
|
|
1647
|
+
date: string;
|
|
1648
|
+
variants: Array<Day.Variant>;
|
|
1649
|
+
}
|
|
1650
|
+
namespace Day {
|
|
1651
|
+
interface Variant {
|
|
1652
|
+
id: string;
|
|
1653
|
+
conversionRate: number;
|
|
1654
|
+
conversions: number;
|
|
1655
|
+
impressions: number;
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
export interface ExperimentListParams extends CursorParams {
|
|
1660
|
+
/**
|
|
1661
|
+
* Optional case-insensitive text search matched against experiment ID, name, and
|
|
1662
|
+
* description.
|
|
1663
|
+
*/
|
|
1664
|
+
search?: string;
|
|
1665
|
+
/**
|
|
1666
|
+
* Optional lifecycle-state filter.
|
|
1667
|
+
*/
|
|
1668
|
+
status?: 'completed' | 'draft' | 'paused' | 'running';
|
|
1669
|
+
/**
|
|
1670
|
+
* Optional experiment-type filter.
|
|
1671
|
+
*/
|
|
1672
|
+
type?: 'ab' | 'multivariate' | 'personalization';
|
|
1673
|
+
}
|
|
1674
|
+
export interface ExperimentCreateParams {
|
|
1675
|
+
/**
|
|
1676
|
+
* ID of the experiment settings record that owns this experiment. Call
|
|
1677
|
+
* `GET /rest/v1/experiment-settings` first if you need to discover the correct ID
|
|
1678
|
+
* for the current account.
|
|
1679
|
+
*/
|
|
1680
|
+
experimentSettingsId: string;
|
|
1681
|
+
/**
|
|
1682
|
+
* Short experiment name.
|
|
1683
|
+
*/
|
|
1684
|
+
name: string;
|
|
1685
|
+
/**
|
|
1686
|
+
* Optional hypothesis or operator note.
|
|
1687
|
+
*/
|
|
1688
|
+
description?: string | null;
|
|
1689
|
+
/**
|
|
1690
|
+
* Whether redirect variants in this experiment should preserve the original
|
|
1691
|
+
* request query string.
|
|
1692
|
+
*/
|
|
1693
|
+
includeQueryString?: boolean | null;
|
|
1694
|
+
/**
|
|
1695
|
+
* Optional stable code-facing key. When omitted, the API slugifies the name
|
|
1696
|
+
* automatically.
|
|
1697
|
+
*/
|
|
1698
|
+
key?: string | null;
|
|
1699
|
+
/**
|
|
1700
|
+
* Goal events. If you send `metrics.primary`, `metrics.primary.eventName` must be
|
|
1701
|
+
* a non-blank string. A primary event name is required before the experiment can
|
|
1702
|
+
* be started.
|
|
1703
|
+
*/
|
|
1704
|
+
metrics?: ExperimentCreateParams.Metrics | null;
|
|
1705
|
+
/**
|
|
1706
|
+
* Eligibility rules — URL patterns, audience, visitor status, query-param
|
|
1707
|
+
* conditions. Omit to inherit defaults.
|
|
1708
|
+
*/
|
|
1709
|
+
targetingRules?: ExperimentCreateParams.TargetingRules | null;
|
|
1710
|
+
/**
|
|
1711
|
+
* Initial traffic allocation percentage from 0 to 100.
|
|
1712
|
+
*/
|
|
1713
|
+
trafficAllocation?: number | null;
|
|
1714
|
+
/**
|
|
1715
|
+
* Experiment mode to create. `ab` and `multivariate` use traffic allocation and
|
|
1716
|
+
* results; `personalization` is always-on targeting. Omit to create a standard
|
|
1717
|
+
* `ab` experiment.
|
|
1718
|
+
*/
|
|
1719
|
+
type?: 'ab' | 'multivariate' | 'personalization' | null;
|
|
1720
|
+
}
|
|
1721
|
+
export declare namespace ExperimentCreateParams {
|
|
1722
|
+
/**
|
|
1723
|
+
* Goal events. If you send `metrics.primary`, `metrics.primary.eventName` must be
|
|
1724
|
+
* a non-blank string. A primary event name is required before the experiment can
|
|
1725
|
+
* be started.
|
|
1726
|
+
*/
|
|
1727
|
+
interface Metrics {
|
|
1728
|
+
/**
|
|
1729
|
+
* Primary success metric. When provided, `eventName` must be a non-blank string.
|
|
1730
|
+
*/
|
|
1731
|
+
primary?: Metrics.Primary | null;
|
|
1732
|
+
/**
|
|
1733
|
+
* Optional secondary metrics tracked alongside the primary goal.
|
|
1734
|
+
*/
|
|
1735
|
+
secondary?: Array<Metrics.Secondary> | null;
|
|
1736
|
+
}
|
|
1737
|
+
namespace Metrics {
|
|
1738
|
+
/**
|
|
1739
|
+
* Primary success metric. When provided, `eventName` must be a non-blank string.
|
|
1740
|
+
*/
|
|
1741
|
+
interface Primary {
|
|
1742
|
+
/**
|
|
1743
|
+
* Event name to use as the goal for this metric.
|
|
1744
|
+
*/
|
|
1745
|
+
eventName?: string | null;
|
|
1746
|
+
/**
|
|
1747
|
+
* Optional funnel identifier when the metric should be derived from an existing
|
|
1748
|
+
* funnel definition.
|
|
1749
|
+
*/
|
|
1750
|
+
funnelId?: string | null;
|
|
1751
|
+
}
|
|
1752
|
+
interface Secondary {
|
|
1753
|
+
/**
|
|
1754
|
+
* Event name to use as the goal for this metric.
|
|
1755
|
+
*/
|
|
1756
|
+
eventName?: string | null;
|
|
1757
|
+
/**
|
|
1758
|
+
* Optional funnel identifier when the metric should be derived from an existing
|
|
1759
|
+
* funnel definition.
|
|
1760
|
+
*/
|
|
1761
|
+
funnelId?: string | null;
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
/**
|
|
1765
|
+
* Eligibility rules — URL patterns, audience, visitor status, query-param
|
|
1766
|
+
* conditions. Omit to inherit defaults.
|
|
1767
|
+
*/
|
|
1768
|
+
interface TargetingRules {
|
|
1769
|
+
/**
|
|
1770
|
+
* Glob-style URL patterns that must match for the experiment to be eligible. Up to
|
|
1771
|
+
* 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
|
|
1772
|
+
* the field) matches all URLs — equivalent to `["**"]`.
|
|
1773
|
+
*/
|
|
1774
|
+
urlPatterns: Array<string>;
|
|
1775
|
+
/**
|
|
1776
|
+
* Optional audience identifier used for server-side eligibility filtering.
|
|
1777
|
+
*/
|
|
1778
|
+
audienceId?: string | null;
|
|
1779
|
+
/**
|
|
1780
|
+
* Additional query-string conditions that must all match for the visitor to
|
|
1781
|
+
* qualify.
|
|
1782
|
+
*/
|
|
1783
|
+
queryParams?: Array<TargetingRules.QueryParam> | null;
|
|
1784
|
+
/**
|
|
1785
|
+
* Optional visitor-property matching rules. These are passed through as JSON for
|
|
1786
|
+
* experimentation targeting.
|
|
1787
|
+
*/
|
|
1788
|
+
visitorProperties?: unknown | null;
|
|
1789
|
+
/**
|
|
1790
|
+
* Whether the experiment should target new visitors, returning visitors, or any
|
|
1791
|
+
* visitor.
|
|
1792
|
+
*/
|
|
1793
|
+
visitorStatus?: string | null;
|
|
1794
|
+
}
|
|
1795
|
+
namespace TargetingRules {
|
|
1796
|
+
interface QueryParam {
|
|
1797
|
+
/**
|
|
1798
|
+
* Query string key to inspect on the current page URL.
|
|
1799
|
+
*/
|
|
1800
|
+
key: string;
|
|
1801
|
+
/**
|
|
1802
|
+
* Comparison operator applied to the query string value.
|
|
1803
|
+
*/
|
|
1804
|
+
operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
|
|
1805
|
+
/**
|
|
1806
|
+
* Comparison value used by operators that require one. Omit for `exists` and
|
|
1807
|
+
* `not_exists`.
|
|
1808
|
+
*/
|
|
1809
|
+
value?: string | null;
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
export interface ExperimentUpdateParams {
|
|
1814
|
+
/**
|
|
1815
|
+
* Updated experiment hypothesis or operator note.
|
|
1816
|
+
*/
|
|
1817
|
+
description?: string | null;
|
|
1818
|
+
/**
|
|
1819
|
+
* Updated redirect query-string forwarding behavior for the experiment.
|
|
1820
|
+
*/
|
|
1821
|
+
includeQueryString?: boolean | null;
|
|
1822
|
+
/**
|
|
1823
|
+
* Updated stable code-facing key. When blank, the API falls back to a slugified
|
|
1824
|
+
* key derived from the current experiment name.
|
|
1825
|
+
*/
|
|
1826
|
+
key?: string | null;
|
|
1827
|
+
/**
|
|
1828
|
+
* Updated goal events. Send the full nested object — replaces the previous value,
|
|
1829
|
+
* not merged. If you send `metrics.primary`, `metrics.primary.eventName` must be a
|
|
1830
|
+
* non-blank string.
|
|
1831
|
+
*/
|
|
1832
|
+
metrics?: ExperimentUpdateParams.Metrics | null;
|
|
1833
|
+
/**
|
|
1834
|
+
* Updated experiment name.
|
|
1835
|
+
*/
|
|
1836
|
+
name?: string | null;
|
|
1837
|
+
/**
|
|
1838
|
+
* Updated eligibility rules. Send the full nested object — replaces the previous
|
|
1839
|
+
* value, not merged.
|
|
1840
|
+
*/
|
|
1841
|
+
targetingRules?: ExperimentUpdateParams.TargetingRules | null;
|
|
1842
|
+
/**
|
|
1843
|
+
* Updated traffic allocation percentage from 0 to 100.
|
|
1844
|
+
*/
|
|
1845
|
+
trafficAllocation?: number | null;
|
|
1846
|
+
}
|
|
1847
|
+
export declare namespace ExperimentUpdateParams {
|
|
1848
|
+
/**
|
|
1849
|
+
* Updated goal events. Send the full nested object — replaces the previous value,
|
|
1850
|
+
* not merged. If you send `metrics.primary`, `metrics.primary.eventName` must be a
|
|
1851
|
+
* non-blank string.
|
|
1852
|
+
*/
|
|
1853
|
+
interface Metrics {
|
|
1854
|
+
/**
|
|
1855
|
+
* Primary success metric. When provided, `eventName` must be a non-blank string.
|
|
1856
|
+
*/
|
|
1857
|
+
primary?: Metrics.Primary | null;
|
|
1858
|
+
/**
|
|
1859
|
+
* Optional secondary metrics tracked alongside the primary goal.
|
|
1860
|
+
*/
|
|
1861
|
+
secondary?: Array<Metrics.Secondary> | null;
|
|
1862
|
+
}
|
|
1863
|
+
namespace Metrics {
|
|
1864
|
+
/**
|
|
1865
|
+
* Primary success metric. When provided, `eventName` must be a non-blank string.
|
|
1866
|
+
*/
|
|
1867
|
+
interface Primary {
|
|
1868
|
+
/**
|
|
1869
|
+
* Event name to use as the goal for this metric.
|
|
1870
|
+
*/
|
|
1871
|
+
eventName?: string | null;
|
|
1872
|
+
/**
|
|
1873
|
+
* Optional funnel identifier when the metric should be derived from an existing
|
|
1874
|
+
* funnel definition.
|
|
1875
|
+
*/
|
|
1876
|
+
funnelId?: string | null;
|
|
1877
|
+
}
|
|
1878
|
+
interface Secondary {
|
|
1879
|
+
/**
|
|
1880
|
+
* Event name to use as the goal for this metric.
|
|
1881
|
+
*/
|
|
1882
|
+
eventName?: string | null;
|
|
1883
|
+
/**
|
|
1884
|
+
* Optional funnel identifier when the metric should be derived from an existing
|
|
1885
|
+
* funnel definition.
|
|
1886
|
+
*/
|
|
1887
|
+
funnelId?: string | null;
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
/**
|
|
1891
|
+
* Updated eligibility rules. Send the full nested object — replaces the previous
|
|
1892
|
+
* value, not merged.
|
|
1893
|
+
*/
|
|
1894
|
+
interface TargetingRules {
|
|
1895
|
+
/**
|
|
1896
|
+
* Glob-style URL patterns that must match for the experiment to be eligible. Up to
|
|
1897
|
+
* 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
|
|
1898
|
+
* the field) matches all URLs — equivalent to `["**"]`.
|
|
1899
|
+
*/
|
|
1900
|
+
urlPatterns: Array<string>;
|
|
1901
|
+
/**
|
|
1902
|
+
* Optional audience identifier used for server-side eligibility filtering.
|
|
1903
|
+
*/
|
|
1904
|
+
audienceId?: string | null;
|
|
1905
|
+
/**
|
|
1906
|
+
* Additional query-string conditions that must all match for the visitor to
|
|
1907
|
+
* qualify.
|
|
1908
|
+
*/
|
|
1909
|
+
queryParams?: Array<TargetingRules.QueryParam> | null;
|
|
1910
|
+
/**
|
|
1911
|
+
* Optional visitor-property matching rules. These are passed through as JSON for
|
|
1912
|
+
* experimentation targeting.
|
|
1913
|
+
*/
|
|
1914
|
+
visitorProperties?: unknown | null;
|
|
1915
|
+
/**
|
|
1916
|
+
* Whether the experiment should target new visitors, returning visitors, or any
|
|
1917
|
+
* visitor.
|
|
1918
|
+
*/
|
|
1919
|
+
visitorStatus?: string | null;
|
|
1920
|
+
}
|
|
1921
|
+
namespace TargetingRules {
|
|
1922
|
+
interface QueryParam {
|
|
1923
|
+
/**
|
|
1924
|
+
* Query string key to inspect on the current page URL.
|
|
1925
|
+
*/
|
|
1926
|
+
key: string;
|
|
1927
|
+
/**
|
|
1928
|
+
* Comparison operator applied to the query string value.
|
|
1929
|
+
*/
|
|
1930
|
+
operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
|
|
1931
|
+
/**
|
|
1932
|
+
* Comparison value used by operators that require one. Omit for `exists` and
|
|
1933
|
+
* `not_exists`.
|
|
1934
|
+
*/
|
|
1935
|
+
value?: string | null;
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
export interface ExperimentStartParams {
|
|
1940
|
+
/**
|
|
1941
|
+
* When true (default on the REST surface), publish the current draft version
|
|
1942
|
+
* immediately after starting the experiment. Any other unpublished changes in the
|
|
1943
|
+
* same account version are included in that publish. Pass `false` explicitly to
|
|
1944
|
+
* stage the change without publishing; the response will report `pending_publish`.
|
|
1945
|
+
*/
|
|
1946
|
+
publishAfterStart?: boolean;
|
|
1947
|
+
}
|
|
1948
|
+
export interface ExperimentStopParams {
|
|
1949
|
+
/**
|
|
1950
|
+
* Optional winning variant ID to persist when completing the experiment.
|
|
1951
|
+
*/
|
|
1952
|
+
winnerVariantId?: string;
|
|
1953
|
+
}
|
|
1954
|
+
export interface ExperimentPauseParams {
|
|
1955
|
+
/**
|
|
1956
|
+
* When true (default on the REST surface), publish the current draft version
|
|
1957
|
+
* immediately after pausing the experiment. Any other unpublished changes in the
|
|
1958
|
+
* same account version are included in that publish. Pass `false` explicitly to
|
|
1959
|
+
* stage the change without publishing; the response will report `pending_publish`.
|
|
1960
|
+
*/
|
|
1961
|
+
publishAfterPause?: boolean;
|
|
1962
|
+
}
|
|
1963
|
+
export interface ExperimentResumeParams {
|
|
1964
|
+
/**
|
|
1965
|
+
* When true (default on the REST surface), publish the current draft version
|
|
1966
|
+
* immediately after resuming the experiment. Any other unpublished changes in the
|
|
1967
|
+
* same account version are included in that publish. Pass `false` explicitly to
|
|
1968
|
+
* stage the change without publishing; the response will report `pending_publish`.
|
|
1969
|
+
*/
|
|
1970
|
+
publishAfterResume?: boolean;
|
|
1971
|
+
}
|
|
1972
|
+
export interface ExperimentResultsParams {
|
|
1973
|
+
/**
|
|
1974
|
+
* Optional override for the conversion event name. When omitted, the experiment
|
|
1975
|
+
* primary metric event is used.
|
|
1976
|
+
*/
|
|
1977
|
+
eventName?: string;
|
|
1978
|
+
}
|
|
1979
|
+
export interface ExperimentResultsTimeSeriesParams {
|
|
1980
|
+
/**
|
|
1981
|
+
* Inclusive upper bound of the response window, as a UTC calendar day in
|
|
1982
|
+
* `YYYY-MM-DD` format. Defaults to the experiment stop date for completed
|
|
1983
|
+
* experiments, or today for running experiments. Values after that are silently
|
|
1984
|
+
* clamped. The window between `startDate` and `endDate` must be 366 days or fewer.
|
|
1985
|
+
*/
|
|
1986
|
+
endDate?: string;
|
|
1987
|
+
/**
|
|
1988
|
+
* Optional override for the conversion event name. When omitted, the experiment
|
|
1989
|
+
* primary metric event is used.
|
|
1990
|
+
*/
|
|
1991
|
+
eventName?: string;
|
|
1992
|
+
/**
|
|
1993
|
+
* Inclusive lower bound of the response window, as a UTC calendar day in
|
|
1994
|
+
* `YYYY-MM-DD` format. Defaults to the experiment start date when omitted. Values
|
|
1995
|
+
* before the experiment started are silently clamped to the experiment start.
|
|
1996
|
+
*/
|
|
1997
|
+
startDate?: string;
|
|
1998
|
+
}
|
|
1999
|
+
export declare namespace Experiments {
|
|
2000
|
+
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 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, };
|
|
2001
|
+
}
|
|
2002
|
+
//# sourceMappingURL=experiments.d.ts.map
|