Skip to main content
POST
/
visit
/
events
Send visitor events
curl --request POST \
  --url https://eu-data.kameleoon.io/visit/events \
  --header 'Content-Type: */*' \
  --header 'user-agent: <user-agent>' \
  --data '"<string>"'

Headers

user-agent
string
default:kameleoon-docs
required

Not always required. Kameleoon rejects an incoming request if the source is a bot or spider, based on IAB/ABC user-agent filtering rules. Kameleoon uses a single-pass method. You don't need to take specific action when sending requests from a web browser using a standard library (XHR). However, in other cases, set a custom value for the User-Agent request header to overwrite the default value the library sets.

Query Parameters

siteCode
string
required

The Kameleoon project ID.

visitorCode
string

The visitor code (a unique Kameleoon ID for a visitor). Note: If you provide the visitorCode parameter here, it is assumed to be the common value for all events in the body. If you want to post several events for different visitors, provide the visitorCode with every event in the body.

json
boolean
default:false

Set to true to provide the body content in JSON format; otherwise, URL query format is assumed. See the body schema for details.

Body

*/*

Save events. The body size limit is 3 MB.

If the json query parameter is missing or set to false, the body consists of one or more lines. Each line represents an event in the following format: <parameter 1 name>=<parameter 1 value>&<parameter 2 name>=<parameter 2 value> and so on. Escape values that may contain characters = or &, for example, using the encodeURIComponent JavaScript function.

If the json query parameter is set to true, provide the body as a JSON array of events. Represent each event as a JSON object, formatted like this: { "<parameter 1 name>": <parameter 1 value>, "<parameter 2 name>": <parameter 2 value>, etc. }.

In all cases, the body contains the following parameters:

NameTypeRequiredDescription
visitorCodestringRequired if you don't provide it in URL query parameters. Otherwise, Kameleoon ignores it.Unique Kameleoon visitor ID.
Limit to 100 characters
noncestringRequiredA random string of 16 hexadecimal characters, unique to each event.
eventTypestringRequiredOne of the following: STATICDATA, PAGE, CONVERSION, TARGETINGSEGMENT, EXPERIMENT, PERSONALIZATION, WEATHER, CUSTOMDATA, PRODUCT, GEOLOCATION


List of parameters for the eventType STATICDATA:
NameTypeRequiredDescription
visitNumberint32OptionalNumber of visits
timeSincePreviousVisitint64OptionalTime since last visit in milliseconds
browserstringOptionalBrowser's name (for example, "Safari").
Limit to 100 characters
browserIndexint32OptionalConfigured browser index
browserVersionfloat64OptionalBrowser version
osstringOptionalOS name (for example, "Windows").
Limit to 100 characters
osIndexint32OptionalConfigured OS index
screenWidthint32OptionalScreen width
screenHeightint32OptionalScreen height
localeLanguageTagstringOptionalLocal language tag (for example, "fr").
deviceTypestringOptionalOne of the following: DESKTOP, TABLET, PHONE


List of parameters for the eventType PAGE:
NameTypeRequiredDescription
hrefstringRequiredComplete URL
Limit to 2048 characters
canonicalHrefstringOptionalCanonical URL
Limit to 2048 characters
titlestringOptionalPage title
Limit to 256 characters
keyPageIndicesJSON arrayOptionalA JSON array of configured key page indices.
referrerHrefstringOptionalComplete URL of the referrer.
referrerIndicesJSON arrayOptionalA JSON array of configured referrer indices.


List of parameters for the eventType CONVERSION:
NameTypeRequiredDescription
goalIdint64RequiredID of the goal
revenuefloat64OptionalRevenue generated in the goal
negativeBooleanOptional,
default false
Should conversion be removed?
metadataJSON objectOptionalJSON object with the following structure: key = metadata id (int32), value = metadata values (JSON array of string)
No more than 256 ids
No more than 256 values for each id
Every value is limited to 2048 characters


List of parameters for the eventType TARGETINGSEGMENT:
NameTypeRequiredDescription
idint64RequiredSegment id


List of parameters for the eventType EXPERIMENT:
NameTypeRequiredDescription
idint64RequiredExperiment id
variationIdint64RequiredVariation id. 0 if reference


List of parameters for the eventType PERSONALIZATION:
NameTypeRequiredDescription
idint64RequiredPersonalization id
variationIdint64RequiredVariation id. 0 if reference
unexpositionCausestringOptionalOnly valid if variationId is 0. One of the following: GLOBAL_EXCLUSION, PERSONALIZATION_CAPPING, SCHEDULE, PERSONALIZATION_EXCLUSION, VISITOR_CAPPING, SCENARIO, PRIORITY


List of parameters for the eventType WEATHER:
NameTypeRequiredDescription
temperaturefloat64RequiredTemperature in Kelvin
humidityfloat64RequiredHumidity percentage
pressurefloat64RequiredAtmospheric pressure in hPa
windSpeedfloat64RequiredWind speed in meters/second
cloudinessfloat64RequiredCloudiness in percentage
sunriseTimeint64RequiredSunrise time as a UNIX millisecond timestamp
sunsetTimeint64RequiredSunset time as a UNIX millisecond timestamp
weatherCodestringOptionalWeather description (for example, "Sky is Clear").
Limit to 100 characters


List of parameters for the eventType CUSTOMDATA:
NameTypeRequiredDescription
indexint32RequiredConfigured custom data index
mappingIdentifierBooleanOptional,
default false
Is this custom data used as a mapping identifier?
valuesCountMapJSON objectRequiredJSON object with the following structure: key = value (string), value = count (int32)
No more than 256 values
Every value is limited to 2048 characters if mappingIdentifier is false, 100 otherwise
overwriteBooleanOptional,
default true
Overwrite previous values counts (or merge)?


List of parameters for the eventType PRODUCT:
NameTypeRequiredDescription
eanstringRequiredProduct code
Limit to 100 characters


List of parameters for the eventType GEOLOCATION:
NameTypeRequiredDescription
countrystringOptionalCountry
Limit to 100 characters
regionstringOptionalRegion
Limit to 100 characters
citystringOptionalCity
Limit to 100 characters
postalCodestringOptionalPostal code
Limit to 100 characters
latitudefloat64OptionalLatitude
longitudefloat64OptionalLongitude


Note: In these examples, Kameleoon assumes you provide the visitorCode parameter in the URL query part.

Body example if the URL query parameter json is missing or its value is false:
nonce=d2ce4d22083348fb&eventType=STATICDATA&browser=Safari&browserVersion=16.3&deviceType=DESKTOP&os=Windows
nonce=b0a4253d8acd01c7&eventType=PAGE&href=https%3A%2F%2Fwww.supersite.com%2Fsuperpage%3Fsuperparam%3Dtrue
nonce=4ca34741a6cc8a48&eventType=CONVERSION&goalId=2&revenue=24.99

Body example if the URL query parameter json is true (pretty representation):

[
{
"nonce": "d2ce4d22083348fb",
"eventType": "STATICDATA",
"browser": "Safari",
"browserVersion": 16.3,
"deviceType": "DESKTOP",
"os": "Windows"
},
{
"nonce": "b0a4253d8acd01c7",
"eventType": "PAGE",
"href": "https://www.supersite.com/superpage?superparam=true"
}
]

The body is of type string<UTF-8>.

Response

Kameleoon processed the URL query and accepted the request. The response returns no content.
Kameleoon processes the body asynchronously and has not checked the body syntax yet.