# What is a server-side event?

> A server-side event is an analytics event that your backend sends, such as a verified purchase or a webhook from a store, instead of the game client.

By Yos Riady. Updated 2026-11-18. Published 2026-11-18. Canonical URL: https://manalens.dev/glossary/server-side-event

A server-side event is an analytics event that your backend sends, not the game or the browser. Use it for facts that the server knows best, such as a verified purchase, a webhook from a payment provider or a result from a game server. A player cannot change it as easily as a client event.

## Key points

- Server events use the secret key, and a request with an Origin header and that key is refused.
- One request holds 1 to 100 events and at most 256 KB, and old timestamps are allowed for backfills.
- Send the client anonymous ID and session ID so a late purchase counts in the right session.

## How do server events work in Manalens?

Your backend sends track and identify events to the same endpoint as the game, POST /v0/events, with channel server. The request uses the project secret key, which starts with mana_sk_. A request with an Origin header and a secret key is refused, so the key cannot work from a browser.

One request holds 1 to 100 events and at most 256 KB. A user_id alone is enough. Old timestamps are allowed for backfills, and a timestamp more than 5 minutes in the future is refused. Server events have their own rate limit, so a flood of browser traffic does not use up your backend quota.

Sources: Manalens server events documentation.

## What does an example look like?

Example: a player buys a $9.99 supporter pack on your own store. The payment webhook reaches your backend 3 hours later. Your game sent its anonymous ID and session ID with the checkout request, and your backend puts both on the purchase event. The purchase then counts in the session where the player clicked buy, with revenue of 9.99. It does not change the session duration.

Sources: worked example; Manalens server events documentation.

## Why do server events matter for indie PC and web games?

A game build and a web page run on the player's machine, so their events can be blocked or changed. A purchase that your backend checked is a stronger fact. Google describes its Measurement Protocol the same way: it records server to server and offline interactions, to add to client collection, not to replace it.

Never put the secret key in a game build or a web page. Keep it in a server-side secret store.

- [Sell your game direct: your own store, Patreon or Stripe](https://manalens.dev/blog/sell-your-game-direct)
- [Analytics API](https://manalens.dev/features/analytics-api)
- [Custom events](https://manalens.dev/features/custom-events)

Sources: Google Analytics Measurement Protocol documentation; Manalens server events documentation.

## Frequently asked questions

### Can I put the secret key in my game?

No. The secret key is for your backend only. A request with an Origin header and a secret key is refused with 403 SECRET_KEY_FROM_BROWSER. Your game uses the publishable key, which can send game events but cannot send server events.

### Can I backfill old events from my server?

Yes. Server events allow old timestamps, so you can backfill events from your own records. A timestamp more than 5 minutes in the future is refused. Set a message_id on each event, so that a retry counts once. One request holds 1 to 100 events and at most 256 KB, so send a large backfill in many requests.

### How do I put a server purchase in the player's session?

Send the anonymous ID and the session ID of the client with the event. The game reads both from the SDK and sends them with its request to your backend. The purchase then counts in that session, even when the webhook arrives hours later.

## Sources

- [Google Analytics documentation: Measurement Protocol for GA4 (read 19 November 2026)](https://developers.google.com/analytics/devguides/collection/protocol/ga4)

## Related guides

- [Sell your game direct: your own store, Patreon or Stripe](https://manalens.dev/blog/sell-your-game-direct)
- [Analytics API](https://manalens.dev/features/analytics-api)
- [Custom events](https://manalens.dev/features/custom-events)
- [Event](https://manalens.dev/glossary/event)
- [Session](https://manalens.dev/glossary/session)
