Skip to main content
Send events to Audience over HTTP from your game server, your backend, or a game built on an engine without an SDK.

Before you start

  • Your project’s publishable key, from Game Analytics > Connect your game or Settings > General in Audience. It starts with pk_imapik-.
  • The player’s consent, recorded before you send their events. The HTTP API doesn’t check consent for you. See Consent.

Send events

Send POST requests to https://api.immutable.com/v1/audience/messages, with your key in the x-immutable-publishable-key header. Each request carries up to 100 messages.
  • messageId is a UUID you generate for each message. Audience uses it to drop duplicates, so reuse it when you retry.
  • anonymousId identifies the device. Use the same one across a player’s requests to join up their activity.
  • userId identifies the player. Send it only at full consent.
  • surface says where the event came from: unity or unreal for events from a game, web for website traffic. Game Analytics counts only unity and unreal, so an event sent as web, or with no surface, is stored but doesn’t show there.
  • context.library names your system, such as my-game-server. Don’t use @imtbl/audience or com.immutable.audience: those belong to the SDKs.

Read the response

Each rejected message is listed in rejections with its messageId and the field that failed. When every message in a request fails, the response is 400 with the same shape. At none, send nothing. At anonymous, leave out userId and anything that identifies the player. At full, send everything. To record a player’s choice with Audience:

Test your setup

Add "test": true to a message while you build. Test events show in the event log but stay out of your boards.

Check it’s working

A 200 with "accepted": 1 means Audience has the event. In Audience, Game Analytics > Connect your game shows First event received within a few minutes. See Check your events arrive.