Skip to main content

Get Experiment Details

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint

/o/ab-testing/experiment-detail

Overview

Retrieve detailed results for a single experiment, including statistical analysis, winner determination, and performance metrics.

Authentication

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions

  • Read (ab_testing feature)

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or use auth_token)API key for authentication
auth_tokenStringYes (or use api_key)Auth token for authentication
app_idStringYesApplication identifier
experiment_idStringYesExperiment ObjectId

Examples

Example 1: Fetch Experiment Details

Request:

curl "https://your-server.com/o/ab-testing/experiment-detail?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&experiment_id=EXPERIMENT_ID"

Response

Success Response

{
"_id": "5d4472152de8f07336f3b352",
"name": "My test experiment",
"target_users": {
"percentage": "11",
"condition": "{}"
},
"goals": [
{
"user_segmentation": "{\"query\":{\"custom.Facebook Login\":{\"$in\":[\"false\"]}},\"queryText\":\"Facebook Login = false\"}"
}
],
"variants": [
{
"name": "Control group",
"parameters": [
{
"name": "button_text",
"value": "q",
"description": ""
}
],
"cohorts": {
"0": "848bfe0549f0f380c38997ddefc7b8ad"
}
},
{
"name": "Variant A",
"parameters": [
{
"name": "button_text",
"value": "w",
"description": ""
}
],
"cohorts": {
"0": "120f0bf72d9cec66c8d928e8472daa6f"
}
}
],
"type": "remote-config",
"status": "completed",
"created_at": 1561310891903,
"id": 2,
"started_at": 1561310891903,
"results": "{\"total_users\":0,\"improvement_data\":[{\"0\":[],\"index\":0,\"label\":\"Control group\",\"total_variant_users\":0},{\"0\":[],\"index\":1,\"label\":\"Variant A\",\"total_variant_users\":0}],\"performance_data\":{\"0\":[]},\"winner\":{\"winner\":null,\"variant_index\":null,\"winner_status\":\"winner_not_found\"}}",
"completed_at": 1564769133960,
"defaults": {
"performance_metrics": [
{
"value": "improvement"
},
{
"value": "conversion_rate"
},
{
"value": "probability_beat_baseline"
},
{
"value": "conversion_number"
}
]
}
}

Response Fields

FieldTypeDescription
_idStringExperiment ObjectId
nameStringExperiment name
statusStringExperiment status (drafts, running, completed)
resultsString (JSON)Serialized results payload
defaults.performance_metricsArrayAvailable performance metrics

Error Responses

If the experiment is not found, the response is an empty object:

{}

Behavior

  • Fetches experiment by experiment_id.
  • Removes size and position fields from response.
  • Adds defaults.performance_metrics.
  • For running experiments, computes live results before responding.
  • Returns {} when the experiment does not exist.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly_out.ab_testing_experiments{appId}Primary:Stores experiment definitions and results.