Checking experimentation exposure, custom data and conversion events
Kameleoon’s Data API is a REST API that offers several functionalities, some of which include storing and retrieving data specific to external users and managing offline goal conversions. In addition, you can use the Data API to determine whether Kameleoon has received visit events which are being sent either automatically by Kameleoon or by the usage of our Activation API or SDKs methods. This article explains how to use the Data API’s GET visit/visitor endpoint to check if given event types have been ingested by Kameleoon. This is particularly useful when qa-ing your tracking code. We will explain how to do it programmatically for these events:
Event parameters
As mentioned above, all requests must be made to the Data API’s GET visit/visitor endpoint .
The requests submitted for Experiment exposure, Custom data, and Conversion events will include the following standard parameters:
Either of:
- visitorCode (string): Kameleoon’s unique Id for a visitor. Required if
mappingValue
is not provided
OR
-
mappingValue (string): Value of the custom data configured as a mapping identifier (acting as a visitor cross-device Id) if applicable. Required if
visitorCode
is not provided -
siteCode (string): This is a unique string of letters and numbers that identifies a Kameleoon project. The steps to retrieve it are in this link.
-
currentVisit (string | optional) : Set this to
true
if you wish to receive data related to the current visits. Note that only users utilizing Feature experimentation can request data for active visits. -
Depending on the specific event you request, each request will include one additional boolean parameter set to
true
: either experiment, customData, or conversion, as demonstrated in the examples below.
Event requests
Below are examples of the format used for the requests and replies, specific to the event:
The domain used in the query will depend on your geographical location: requests will be structured as eu-data.kameleoon.[io|eu]
if you are in Europe and na-data.kameleoon.[io|eu]
if you are in North America.
For a more user-friendly output, you may include the parameter prettyPrint=true
in the request's header.
Experiment exposure
Request
curl -X GET 'https://eu-data.kameleoon.io/visit/visitor?siteCode=f17c21u1ag&visitorCode=245fc¤tVisit=true&maxNumberPreviousVisits=20&experiment=true'
Response
{
"previousVisits": [
{
"siteCode": "f17c21u1ag",
"visitorCode": "245fc",
"timeStarted": 1748912914969,
"timeLastEvent": 1748912914969,
"experimentEvents": [
{
"itp": false,
"tabId": -218793282,
"time": 1748977476606,
"data": {
"id": 250830,
"variationId": 978588
}
}
]
}
]
}
In this example response provided, id
represents the Id for the experiment, while variationId
is the specific variant of the experiment that the visitor is exposed to.
Custom data
Request
curl -X GET 'https://eu-data.kameleoon.io/visit/visitor?siteCode=f17c21u1ag&visitorCode=245fc¤tVisit=true&maxNumberPreviousVisits=20&customdata=true'
Response
{
"previousVisits": [
{
"siteCode": "f17c21u1ag",
"visitorCode": "245fc",
"timeStarted": 1748912914969,
"timeLastEvent": 1748912914969,
"customDataEvents": [
"itp": false,
"tabId": 51426880,
"time": 1748978024982,
"data": {
"index": 1,
"valuesCountMap": {
"true":1
},
"overwrite": true,
"mappingIdentifier": false
},
"itp": false,
"tabId": 51426880,
"time": 1748978024982,
"data": {
"index": 3,
"valuesCountMap": {
"1": 1},
},
"overwrite": false,
"mappingIdentifier": false
]
}
]
}
In this example response provided, index
is the unique Id of the custom data.
Conversion
Request
curl -X GET 'https://eu-data.kameleoon.io/visit/visitor?siteCode=f17c21u1ag&visitorCode=245fc¤tVisit=true&maxNumberPreviousVisits=20&conversion=true'
Response
{
"previousVisits": [
{
"siteCode": "f17c21u1ag",
"visitorCode": "245fc",
"timeStarted": 1748912914969,
"timeLastEvent": 1748912914969,
"conversionEvents": [
{
"itp": false,
"time": 1748912914969,
"data": {
"goalId": 361517,
"revenue": 23.5,
"negative": false,
"metadata": {}
}
}
]
}
]
}