Record a behavioural event for a recognised visitor
const url = 'https://api.ebitex.io/audience/delivery/v1/event';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"visitor":"example","consent":{"cmp":"example","gpc":true,"dnt":true,"cmpString":"example"},"kind":"example","subject":{"categories":["example"]},"value":1,"eventId":"example","events":[{"kind":"example","subject":{"categories":["example"]},"value":1,"eventId":"example"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.ebitex.io/audience/delivery/v1/event \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "visitor": "example", "consent": { "cmp": "example", "gpc": true, "dnt": true, "cmpString": "example" }, "kind": "example", "subject": { "categories": [ "example" ] }, "value": 1, "eventId": "example", "events": [ { "kind": "example", "subject": { "categories": [ "example" ] }, "value": 1, "eventId": "example" } ] }'Call this when a visitor does something your site wants counted toward audiences, for example viewing a page in a category. An event is not an interaction: an interaction (/interaction) is a meaningful fact that appears on the person’s timeline, while an event is a high-volume signal that is kept only briefly and shown nowhere as a row. Audiences read counts of events (for example “viewed a page in Espresso at least three times in the last seven days”), never the events themselves.
Send one event (kind, subject, optional value and eventId) or up to 20 in events. visitor is the device’s token and consent its raw consent signals, as for visitors/session. An event is recorded only when the device is recognised: a recognition token that has not been forgotten, consent granted on this device, and a link from the device to a person. Otherwise the answer is 202 with recorded: false and the reason, and nothing is stored: an anonymous visitor’s events are never kept. This call never creates a person or links a device to one.
kind is a registered kind. The first is content.viewed, whose subject.categories lists the page’s category ids including their ancestors (a published page’s classification already has them), at most 16, and whose optional value is seconds on the page, 0 to 86400. eventId makes a retry safe: the same one again for the same subject on the same day records nothing new.
Recording is asynchronous and never slows your page: a 200 means the event was queued, and under heavy load it can be dropped (event_queue_full). A switched-off feature, an unconfigured store, an organization at its monthly allowance and a device over its daily soft limit all answer 202 with a reason, never an error. A browser’s Sec-GPC and DNT headers count even if you do not forward them. The response is private, no-store.
Key: audience.delivery.read
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
Examplegenerated
{ "visitor": "example", "consent": { "cmp": "example", "gpc": true, "dnt": true, "cmpString": "example" }, "kind": "example", "subject": { "categories": [ "example" ] }, "value": 1, "eventId": "example", "events": [ { "kind": "example", "subject": { "categories": [ "example" ] }, "value": 1, "eventId": "example" } ]}Responses
Section titled “ Responses ”200 with { "recorded": true, "reason": null, "results": [{ "recorded": true, "reason": null }] } when at least one event was queued, or 202 with recorded: false and a reason (no_visitor, token_invalid, session_token, revoked, recognition_not_granted, events_disabled, events_unconfigured, event_allowance_reached, event_cap_reached) when none was. results has one entry per event, in order.
validation_failed (an unregistered kind, a category that is not an id, none or more than 16 categories, a bad value or eventId, or more than 20 events; the errors member names each).
invalid_api_key: the key is missing, revoked, expired or not an Audience delivery key.
missing_api_key or invalid_api_key: no key was sent, or it is unknown, revoked or expired.
origin_denied or ip_denied: the key’s restriction does not admit this request. app_not_available.
scope_denied: the key lacks this route’s scope. origin_denied or ip_denied: a browser-safe key was used from an origin or address outside its restrictions. app_not_available: Content is not enabled for the organization.
The body is larger than 32 KiB.
rate_limited: the key’s per-minute budget is spent; Retry-After says when it resets.
Quota exceeded; Retry-After says how long to wait. too_many_failed_authentications: too many bad keys from this address.