POST /v0/events. Each event has channel: 'server', and the request uses the project secret key.
Create the secret key
- Open your project and go to Settings > General > Credentials.
- Click Create secret key. You must be an owner or admin with an MFA session.
- Copy the key. It starts with
ua_sk_and is shown only once. ManaLens stores only a SHA-256 hash and a short display prefix.
project.secret_key_created, project.secret_key_rotated, project.secret_key_revoked).
The publishable key cannot send server events, and the secret key cannot send web or app events. See authentication.
Send events
Send the secret key asAuthorization: Bearer. Do not send an x-publishable-key header in the same request.
Node.js
Rules
- Every event in the batch has
channel: 'server'. A batch that mixes server events with web or app events gets400MIXED_CHANNELS. - Types are
trackandidentifyonly. - Up to 100 events in one request, and at most 256 KB.
user_idalone is enough. You can also sendanonymous_id, or both.message_idandoriginal_timestampare optional. Old timestamps are allowed, so you can backfill. A timestamp more than 5 minutes in the future is refused.- Server events have their own rate limit bucket, so browser traffic does not use up the quota of your backend.
Context
The request comes from your backend, so its IP address and user agent are not the player’s. The collector does not use the request IP or the request user agent for server events. Your backend can forward the player’s values incontext:
All context fields are optional.
Join server events to players
user_idonly: the event gets a stable project-scoped ID, so the user counts as one visitor.anonymous_idonly: forward the ID of the browser or game (analytics.getAnonymousId()in the web SDK) to join the event to that visitor.- Both: the event links that browser or game to the user, so earlier anonymous activity joins the user’s profile.
Session ID of the client
Send the session ID of the client with your server call. The event is then in the visitor’s session, also when your backend sends it late (for example after a payment webhook, hours or a day later). A server event adds its event and revenue to the session and does not change the session duration: the duration comes from the events that the website or the game sent.- The client reads its two IDs and sends them with its request to your backend:
getAnonymousId()andgetSessionId()in the web SDK and the Node SDK app mode,get_anonymous_id()andget_session_id()in Godot,AnonymousIdandSessionIdin Unity. - Your backend puts them on the event as
anonymous_idandsession_id.
- A
session_idneeds theanonymous_idof the same client: a session belongs to oneanonymous_id. - A server event without a
session_idstays valid. It joins the session of the sameanonymous_idthat is active at that time, or one that starts in the next 30 minutes. If there is none, the event is in no session that counts. It still counts as an event and as revenue. - The rule that an event needs a session ID is for website and game events (the publishable key). It does not apply to server events.
Retries
Set amessage_id (a UUID) on each event. If you send the same event twice, reports count it once. If you omit it, the collector creates one.
Errors
See errors for the full list.
Reports
Server events appear in every event report, on profiles, in the Users list, retention, funnels and breakdowns. Their originchannel is server. They have no acquisition channel, so channel reports show them as Direct.