POST /v0/events, takes website (web), game (app) and server (server) events. A batch is either all server events or has no server events.
Browser events
channel: 'app' and context.app, see app events.
Event fields
Checks
X-Publishable-Keymust be the publishable key of a project. A secret key or an API key in this header gets401.- Send no
Authorizationheader. - A browser
Originmust be the project domain or one of its subdomains. A request with noOrigin(for example from a server proxy) is allowed; the page URL check still applies. - Unknown fields are rejected.
The session ID contract
Reports count sessions from thesession_id of each event. So a website or game event must follow three rules:
- An event with an
anonymous_idhas asession_id. - The
session_idis not theanonymous_id. Make a new ID for each session: start a new session after 30 minutes without events, and when the session is 24 hours old. - An event before consent has no
anonymous_idand nosession_id. It is accepted and stored, and it is in no session.
400 INVALID_EVENT, and no event of the batch is accepted. The response lists each refused event (at most 50) with its position in the batch, its message_id and a reason code:
Do not send a refused batch again without a change: it is refused again. The SDKs drop it and log the reason. The contract does not apply to server events: a server event with no
session_id is valid.
Responses
Server events
Server event fields
Unknown fields are rejected. The collector does not use the request IP or the request user agent for server events.
Server event checks
Authorization: Bearermust be the secret key of a project. Send noX-Publishable-Keyheader.- The request must not have an
Originheader. - Every event in the batch has
channel: 'server'.