(experiments)
- create - Create Experiment
- list - List Experiments
- get - Get Experiment
- updatePartial - Partially Update Experiment
- updateFull - Fully Update Experiment
- delete - Deleted Experiment
- start - Start Experiment
- finishEarly - Finish Experiment Early
- reset - Reset Experiment
- abandon - Abandon Experiment
- archive - Archive Experiment
- unarchive - Unarchive Experiment
- updateAssignmentSource - Post Assignment Source
- deleteAssignmentSource - Delete Assignment Source
- getOverrides - Get Experiment Overrides
- updateOverrides - Update Experiment Overrides
- partialUpdateOverrides - Partially Update Experiment Overrides
- getExposureCount - Get Exposure Count for Experiment
Create Experiment
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.create({
experimentCreateDto: {
name: "<value>",
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsCreate } from "statsig/funcs/experimentsCreate.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsCreate(statsig, {
experimentCreateDto: {
name: "<value>",
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentsControllerGenCreateRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentsControllerGenCreateResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentsControllerGenCreateResponseBody | 400 | application/json |
errors.ConsoleV1ExperimentsControllerGenCreateExperimentsResponseBody | 401 | application/json |
errors.SDKError | 4xx-5xx | / |
List Experiments
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.list({
tags: {
"singleTag": {
"value": "tag1",
},
"multipleTags": {
"value": [
"tag1",
"tag2",
],
},
},
limit: 10,
page: 1,
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsList } from "statsig/funcs/experimentsList.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsList(statsig, {
tags: {
"singleTag": {
"value": "tag1",
},
"multipleTags": {
"value": [
"tag1",
"tag2",
],
},
},
limit: 10,
page: 1,
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentsControllerGenListRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentsControllerGenListResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentsControllerGenListResponseBody | 401 | application/json |
errors.SDKError | 4xx-5xx | / |
Get Experiment
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.get({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsGet } from "statsig/funcs/experimentsGet.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsGet(statsig, {
id: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentsControllerGenReadRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentsControllerGenReadResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentsControllerGenReadResponseBody | 401 | application/json |
errors.ConsoleV1ExperimentsControllerGenReadExperimentsResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Partially Update Experiment
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.updatePartial({
id: "<id>",
experimentPartialUpdateDto: {},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsUpdatePartial } from "statsig/funcs/experimentsUpdatePartial.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsUpdatePartial(statsig, {
id: "<id>",
experimentPartialUpdateDto: {},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentsControllerGenPartialUpdateRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentsControllerGenPartialUpdateResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentsControllerGenPartialUpdateResponseBody | 401 | application/json |
errors.ConsoleV1ExperimentsControllerGenPartialUpdateExperimentsResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Fully Update Experiment
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.updateFull({
id: "<id>",
experimentFullUpdateDto: {
description: "Programmable dynamic interface",
idType: "<value>",
hypothesis: "<value>",
groups: [
{
name: "<value>",
size: 1865.53,
parameterValues: {
"key": "<value>",
},
},
],
allocation: 2413.36,
targetingGateID: "<value>",
bonferroniCorrection: false,
defaultConfidenceInterval: "90",
status: "abandoned",
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsUpdateFull } from "statsig/funcs/experimentsUpdateFull.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsUpdateFull(statsig, {
id: "<id>",
experimentFullUpdateDto: {
description: "Organized national attitude",
idType: "<value>",
hypothesis: "<value>",
groups: [
{
name: "<value>",
size: 3361.08,
parameterValues: {
"key": "<value>",
},
},
],
allocation: 2036.7,
targetingGateID: "<value>",
bonferroniCorrection: false,
defaultConfidenceInterval: "80",
status: "abandoned",
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentsControllerGenFullUpdateRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentsControllerGenFullUpdateResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentsControllerGenFullUpdateResponseBody | 400 | application/json |
errors.ConsoleV1ExperimentsControllerGenFullUpdateExperimentsResponseBody | 401 | application/json |
errors.SDKError | 4xx-5xx | / |
Deleted Experiment
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.delete({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsDelete } from "statsig/funcs/experimentsDelete.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsDelete(statsig, {
id: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentsControllerGenRemoveRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentsControllerGenRemoveResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentsControllerGenRemoveResponseBody | 401 | application/json |
errors.ConsoleV1ExperimentsControllerGenRemoveExperimentsResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Start Experiment
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.start({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsStart } from "statsig/funcs/experimentsStart.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsStart(statsig, {
id: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentsControllerGenStartRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentsControllerGenStartResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentsControllerGenStartResponseBody | 400 | application/json |
errors.ConsoleV1ExperimentsControllerGenStartExperimentsResponseBody | 401 | application/json |
errors.ConsoleV1ExperimentsControllerGenStartExperimentsResponseResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Finish Experiment Early
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.finishEarly({
id: "<id>",
experimentStatusUpdateDto: {
id: "experiment123",
decisionReason: "Your reason for stopping early",
removeTargeting: false,
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsFinishEarly } from "statsig/funcs/experimentsFinishEarly.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsFinishEarly(statsig, {
id: "<id>",
experimentStatusUpdateDto: {
id: "experiment123",
decisionReason: "Your reason for stopping early",
removeTargeting: false,
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentsControllerGenMakeDecisionRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentsControllerGenMakeDecisionResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentsControllerGenMakeDecisionResponseBody | 400 | application/json |
errors.ConsoleV1ExperimentsControllerGenMakeDecisionExperimentsResponseBody | 401 | application/json |
errors.ConsoleV1ExperimentsControllerGenMakeDecisionExperimentsResponseResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Reset Experiment
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.reset({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsReset } from "statsig/funcs/experimentsReset.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsReset(statsig, {
id: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentsControllerGenResetRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentsControllerGenResetResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentsControllerGenResetResponseBody | 400 | application/json |
errors.ConsoleV1ExperimentsControllerGenResetExperimentsResponseBody | 401 | application/json |
errors.ConsoleV1ExperimentsControllerGenResetExperimentsResponseResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Abandon Experiment
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.abandon({
id: "<id>",
experimentStatusUpdateDto: {
id: "experiment123",
decisionReason: "Your reason for stopping early",
removeTargeting: false,
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsAbandon } from "statsig/funcs/experimentsAbandon.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsAbandon(statsig, {
id: "<id>",
experimentStatusUpdateDto: {
id: "experiment123",
decisionReason: "Your reason for stopping early",
removeTargeting: false,
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentsControllerGenAbandonRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentsControllerGenAbandonResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentsControllerGenAbandonResponseBody | 400 | application/json |
errors.ConsoleV1ExperimentsControllerGenAbandonExperimentsResponseBody | 401 | application/json |
errors.ConsoleV1ExperimentsControllerGenAbandonExperimentsResponseResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Archive Experiment
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.archive({
id: "<id>",
experimentArchiveDto: {
archiveReason: "The experiment is no longer needed",
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsArchive } from "statsig/funcs/experimentsArchive.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsArchive(statsig, {
id: "<id>",
experimentArchiveDto: {
archiveReason: "The experiment is no longer needed",
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentsControllerGenArchiveRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentsControllerGenArchiveResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentsControllerGenArchiveResponseBody | 401 | application/json |
errors.ConsoleV1ExperimentsControllerGenArchiveExperimentsResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Unarchive Experiment
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.unarchive({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsUnarchive } from "statsig/funcs/experimentsUnarchive.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsUnarchive(statsig, {
id: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentsControllerGenUnarchiveRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentsControllerGenUnarchiveResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentsControllerGenUnarchiveResponseBody | 401 | application/json |
errors.ConsoleV1ExperimentsControllerGenUnarchiveExperimentsResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Post Assignment Source
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.updateAssignmentSource({
name: "<value>",
assignmentSourceQueryUpdateDto: {
sql: "<value>",
timestampColumn: "<value>",
experimentIDColumn: "<value>",
groupIDColumn: "<value>",
idTypeMapping: [
{
statsigUnitID: "<value>",
column: "<value>",
},
],
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsUpdateAssignmentSource } from "statsig/funcs/experimentsUpdateAssignmentSource.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsUpdateAssignmentSource(statsig, {
name: "<value>",
assignmentSourceQueryUpdateDto: {
sql: "<value>",
timestampColumn: "<value>",
experimentIDColumn: "<value>",
groupIDColumn: "<value>",
idTypeMapping: [
{
statsigUnitID: "<value>",
column: "<value>",
},
],
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentsControllerGenUpdateAssignmentSourceQueryRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentsControllerGenUpdateAssignmentSourceQueryResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentsControllerGenUpdateAssignmentSourceQueryResponseBody | 400 | application/json |
errors.ConsoleV1ExperimentsControllerGenUpdateAssignmentSourceQueryExperimentsResponseBody | 401 | application/json |
errors.ConsoleV1ExperimentsControllerGenUpdateAssignmentSourceQueryExperimentsResponseResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Delete Assignment Source
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.deleteAssignmentSource({
name: "<value>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsDeleteAssignmentSource } from "statsig/funcs/experimentsDeleteAssignmentSource.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsDeleteAssignmentSource(statsig, {
name: "<value>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentsControllerGenRemoveAssignmentSourceRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentsControllerGenRemoveAssignmentSourceResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Get Experiment Overrides
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.getOverrides({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsGetOverrides } from "statsig/funcs/experimentsGetOverrides.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsGetOverrides(statsig, {
id: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentOverridesControllerGenReadRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentOverridesControllerGenReadResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentOverridesControllerGenReadResponseBody | 401 | application/json |
errors.ConsoleV1ExperimentOverridesControllerGenReadExperimentsResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Update Experiment Overrides
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.updateOverrides({
id: "<id>",
experimentOverridesDto: {
overrides: [
{
type: "segment",
id: "<id>",
groupID: "<value>",
},
],
userIDOverrides: [
{
groupID: "<value>",
ids: [
"<value>",
],
},
],
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsUpdateOverrides } from "statsig/funcs/experimentsUpdateOverrides.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsUpdateOverrides(statsig, {
id: "<id>",
experimentOverridesDto: {
overrides: [
{
type: "gate",
id: "<id>",
groupID: "<value>",
},
],
userIDOverrides: [
{
groupID: "<value>",
ids: [
"<value>",
],
},
],
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentOverridesControllerUpdateRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentOverridesControllerUpdateResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentOverridesControllerUpdateResponseBody | 401 | application/json |
errors.ConsoleV1ExperimentOverridesControllerUpdateExperimentsResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Partially Update Experiment Overrides
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.partialUpdateOverrides({
id: "<id>",
experimentOverridesDto: {
overrides: [
{
type: "gate",
id: "<id>",
groupID: "<value>",
},
],
userIDOverrides: [
{
groupID: "<value>",
ids: [
"<value>",
],
},
],
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsPartialUpdateOverrides } from "statsig/funcs/experimentsPartialUpdateOverrides.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsPartialUpdateOverrides(statsig, {
id: "<id>",
experimentOverridesDto: {
overrides: [
{
type: "segment",
id: "<id>",
groupID: "<value>",
},
],
userIDOverrides: [
{
groupID: "<value>",
ids: [
"<value>",
],
},
],
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExperimentOverridesControllerAddRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ConsoleV1ExperimentOverridesControllerAddResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1ExperimentOverridesControllerAddResponseBody | 401 | application/json |
errors.ConsoleV1ExperimentOverridesControllerAddExperimentsResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Get Exposure Count for Experiment
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.experiments.getExposureCount({
experimentName: "<value>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { experimentsGetExposureCount } from "statsig/funcs/experimentsGetExposureCount.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await experimentsGetExposureCount(statsig, {
experimentName: "<value>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1ExposuresControllerExposureCountRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.ExposureCountDto>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |