Below you will find instructions for how to submit metric data for your experiment programmatically.
Generate a token
Endpoint: POST https://app.mysiteoptimization.com/api/1.1/wf/token
Content Type: application/json
Data:
{
"email": "",
"password": ""
}
Response:
{
"status": "success",
"response": {
"token": "your-token",
"user_id": "user-id",
"expires": 31536000
}
}
Submit Metric Data
Endpoint: POST https://app.mysiteoptimization.com/api/1.1/wf/metric?api_key=[EXPERIMENT_API_KEY]
Content Type: application/json
Authentication: Use the token returned from the response above as a Bearer token in your Authentication header during the request.
You can find your experiment’s api_key (make sure to include as query parameter in request) by opening the Experiment Wizard by clicking “Edit” on your desired experiment from the dashboard. The key will be available at the bottom of the page.
Data:
{
"source":"Metric datasource goes here",
"value": "1000.00",
"variant_id": "B", // uppercase variant code, A or B
"kpi": "revenue" // kpi name (must be provided exactly as saved)
}
Response:
{
"status": "success",
"response": {
"metric_id": "api-metric-5"
}
}