Log Endpoint
1 min
POST
https://logx.optimizely.com/v1/events
Body Parameters
- bodyEventBatchrequiredDescription
- account_idstringrequiredExampleDescription
- anonymize_ipbooleanDescriptionDefaulttrue
- client_namestringExampleDescription
- client_versionstringExampleDescription
- enrich_decisionsbooleanDescriptionDefaultfalse
- project_idstringExampleDescription
- visitorsVisitor[]requiredDescription
- attributesAttribute[]Description
- entity_idstringExampleDescription
- keystringExampleDescription
- typestringrequiredExampleDescription
- valuerequiredExampleDescription
- session_idstringExampleDescription
- snapshotsSnapshot[]requiredDescription
- decisionsDecision[]Description
- campaign_idstringrequiredExampleDescription
- experiment_idstringrequiredExampleDescription
- is_campaign_holdbackbooleanDescription
- variation_idstringrequiredExampleDescription
- eventsEvent[]requiredDescription
- entity_idstringExampleDescription
- keystringExampleDescription
- quantityintegerExampleDescription
- revenueinteger<int64>ExampleDescriptionFormatint64
- tagsTagsExample
{ "duration": 22, "video_title": "Funny Cats" }Description - timestampintegerrequiredExampleDescription
- typestringExampleDescription
- uuidstringrequiredExampleDescription
- valuenumberExampleDescription
- visitor_idstringrequiredExampleDescription
Responses
204
400
500
curl
curl --request POST \
--url https://logx.optimizely.com/v1/events \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"account_id": "1234",
"anonymize_ip": true,
"visitors": [
{
"attributes": [
{
"type": "custom",
"value": "nike zoom air"
}
],
"snapshots": [
{
"decisions": [
{
"campaign_id": "4321",
"experiment_id": "1234",
"variation_id": "5678"
}
],
"events": [
{
"timestamp": 1485989442742316000,
"uuid": "0255F96D-922B-433B-B474-5D87EC1AB122"
}
]
}
],
"visitor_id": "user_32912378471284"
}
]
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"account_id": "1234",
"anonymize_ip": true,
"visitors": [
{
"attributes": [
{
"type": "custom",
"value": "nike zoom air"
}
],
"snapshots": [
{
"decisions": [
{
"campaign_id": "4321",
"experiment_id": "1234",
"variation_id": "5678"
}
],
"events": [
{
"timestamp": 1485989442742316000,
"uuid": "0255F96D-922B-433B-B474-5D87EC1AB122"
}
]
}
],
"visitor_id": "user_32912378471284"
}
]
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://logx.optimizely.com/v1/events", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://logx.optimizely.com/v1/events")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"account_id": "1234",
"anonymize_ip": true,
"visitors": [
{
"attributes": [
{
"type": "custom",
"value": "nike zoom air"
}
],
"snapshots": [
{
"decisions": [
{
"campaign_id": "4321",
"experiment_id": "1234",
"variation_id": "5678"
}
],
"events": [
{
"timestamp": 1485989442742316000,
"uuid": "0255F96D-922B-433B-B474-5D87EC1AB122"
}
]
}
],
"visitor_id": "user_32912378471284"
}
]
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://logx.optimizely.com/v1/events"
payload = json.dumps({
"account_id": "1234",
"anonymize_ip": True,
"visitors": [
{
"attributes": [
{
"type": "custom",
"value": "nike zoom air"
}
],
"snapshots": [
{
"decisions": [
{
"campaign_id": "4321",
"experiment_id": "1234",
"variation_id": "5678"
}
],
"events": [
{
"timestamp": 1485989442742316000,
"uuid": "0255F96D-922B-433B-B474-5D87EC1AB122"
}
]
}
],
"visitor_id": "user_32912378471284"
}
]
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
204
// The events were queued for recording by the Optimizely backend.
400
// The request is malformed or otherwise failed validation by the Optimizely backend.
500
// A server error occurred. The client should attempt to resend the events at a later time.