Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.kameleoon.com/llms.txt

Use this file to discover all available pages before exploring further.

Kameleoon’s Data API is a REST API that offers several functionalities, including storing and retrieving data specific to external users and managing offline goal conversions. Use the Data API to determine whether Kameleoon has received visit events sent automatically by Kameleoon or through the Activation API or SDK methods. This article explains how to use the Data API’s GET visit/visitor endpoint to check if specific event types have been ingested by Kameleoon. This verification is particularly useful when testing tracking code. The following sections explain how to check these events programmatically:

Event parameters

As mentioned above, all requests must be made to the Data API’s GET visit/visitor endpoint . Standard parameters for Experiment exposure, Custom data, and Conversion event requests include: Either:
  • 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): A unique string of letters and numbers that identifies a Kameleoon project. Retrieve this code via this link.
  • currentVisit (string | optional): Set to true to receive data related to current visits. Only users utilizing Feature Experimentation can request data for active visits.
  • Depending on the specific event requested, each request must 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 requests and replies, specific to each event:
For a more user-friendly output, include the parameter prettyPrint=true in the request header.

Experiment exposure

Request
curl -X GET 'https://eu-data.kameleoon.io/visit/visitor?siteCode=f17c21u1ag&visitorCode=245fc&currentVisit=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 the example response, id represents the ID for the experiment, while variationId is the specific variation 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&currentVisit=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 the example response, 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&currentVisit=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": {}
                	}
            	}
        	]
    	}
	]
}