Analytics Webhooks
Aghanim's analytics webhooks notify your game of frontend-only player interactions on the game hub and checkout page.
These webhooks are organized into two namespaces based on where the interaction occurs:
analytics.hub.*— Events from the game hubanalytics.checkout.*— Events from the checkout page
This webhook is activated through the Analytics events event, selectable in Game → Webhooks.
Requirements
To use the analytics events webhook from Aghanim, you should have the webhook server configured as follows:
- HTTPS endpoint, accepting POST webhook requests.
- Listen for events, generated and signed by Aghanim.
- Respond with 2xx status codes if the event was processed successfully, and 4xx or 5xx for denial or errors.
Configuration
- Develop a function for the
analytics.*webhook processing. - Make your endpoint available.
- Register your endpoint within Aghanim account → Game → Webhooks → Add webhook by choosing the analytics events event type.
Alternatively, you can register your endpoint within Aghanim using the Create Webhook API method.
Analytics events can generate high volumes of traffic. Consider enabling batch mode to receive events as downloadable JSONL files instead of individual HTTP requests.
Trigger values
| Value | Emits | Description |
|---|---|---|
hub.interact | analytics.hub.* | Player interacted with the game hub (sign-up, login, buy click, etc.). |
checkout.interact | analytics.checkout.* | Player interacted with the checkout page (pageview, form submit, etc.). |
test | Any analytics event | When using the "Send test event" in the Dashboard. |
See the full events and triggers matrix for how analytics events relate to other event types.
Request schema
Below is an example of an analytics.hub.buy_click webhook request:
- HTTP
- cURL
POST /your/webhook/uri HTTP/1.1
Content-Type: application/json
Host: your-webhook-endpoint.com
User-Agent: Aghanim/0.1.0
X-Aghanim-Signature: 2e45ed4dede5e09506717490655d2f78e96d4261040ef48cc623a780bda38812
X-Aghanim-Signature-Timestamp: 1725548450
{
"event_type": "analytics.hub.buy_click",
"event_data": {
"name": "hub.buy_click",
"action": "event",
"label": "",
"user_id": "usr_eymySUreClx",
"player_id": "2D2R-OP3C",
"order_id": null,
"device": {
"type": "mobile",
"model": "iPhone"
},
"country": "US",
"referrer": "https://manabuff.com/store",
"useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
"tz_offset": 5
},
"event_time": 1725548450,
"event_id": "whevt_eCacGbJVbvToOgzjXUgOCitkQE",
"idempotency_key": null,
"request_id": "d1593e9c-c291-4004-8846-6679c2e5810b",
"sandbox": false,
"trigger": "hub.interact",
"transaction_id": "whtx_eCacGbJVbvT",
"context": null,
"game_id": "gm_exTAyxPsVwh"
}
curl "https://your-webhook-endpoint.com/your/webhook/uri" \
-X POST \
-H "Content-Type: application/json" \
-H "User-Agent: Aghanim/0.1.0" \
-H "X-Aghanim-Signature: 2e45ed4dede5e09506717490655d2f78e96d4261040ef48cc623a780bda38812" \
-H "X-Aghanim-Signature-Timestamp: 1725548450" \
-d '{
"event_type": "analytics.hub.buy_click",
"event_data": {
"name": "hub.buy_click",
"action": "event",
"label": "",
"user_id": "usr_eymySUreClx",
"player_id": "2D2R-OP3C",
"order_id": null,
"device": {
"type": "mobile",
"model": "iPhone"
},
"country": "US",
"referrer": "https://manabuff.com/store",
"useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
"tz_offset": 5
},
"event_time": 1725548450,
"event_id": "whevt_eCacGbJVbvToOgzjXUgOCitkQE",
"idempotency_key": null,
"request_id": "d1593e9c-c291-4004-8846-6679c2e5810b",
"sandbox": false,
"trigger": "hub.interact",
"transaction_id": "whtx_eCacGbJVbvT",
"context": null,
"game_id": "gm_exTAyxPsVwh"
}'
The Event schema
| Key | Type | Description |
|---|---|---|
event_id | string | Unique Event ID generated by Aghanim. |
game_id | string | Your game ID in the Aghanim system. |
event_type | string | The type of the event, analytics.hub.buy_click in this case. |
event_time | number | Event date in Unix epoch time. |
event_data | EventData | Contains the event-specific data, with possible keys for inherited objects. |
idempotency_key | string|null | Ensures webhook actions are executed only once, even if retried. Can be null depending on event type. |
request_id | string|null | If the event was triggered by an API request, the request ID is included. |
sandbox | boolean | Indicates whether the event was sent from the sandbox game environment. |
trigger | string|null | The trigger that caused the event to be sent. |
transaction_id | string | The transaction ID generated by Aghanim. This ID may be the same for multiple events emitted within the same transaction. |
context | object|null | Contextual information about the event. |
The EventData schema
| Field | Type | Description |
|---|---|---|
name | string | The analytics event name (e.g. hub.sign_up, hub.buy_click, checkout.submit_payment_form) |
action | string | Interaction action (event, click, submit, open, close, error) |
label | string|null | Event-specific context (e.g. login method, payment method name). Can be null |
user_id | string | Aghanim user ID |
player_id | string | The player ID in your game |
order_id | string|null | Associated order ID, if applicable |
device | Device | Device information |
country | string | Player's country code (e.g. US, DE) |
referrer | string | Traffic source URL. Can be empty |
useragent | string | Browser user agent string |
tz_offset | number | Player's timezone offset in hours from UTC |
The Device schema
| Field | Type | Description |
|---|---|---|
type | string | mobile or desktop |
model | string | Device model when available (e.g. iPhone, Android). Can be empty |
Game hub events
Events triggered by player interactions on the game hub.
| Event | Description |
|---|---|
analytics.hub.buy_click | Player initiated a purchase |
analytics.hub.free_item_claimed | Player claimed a free item |
analytics.hub.login | Player logged in to the hub |
analytics.hub.sign_up | Player registered on the hub |
Checkout events
Events triggered by player interactions on the checkout page.
| Event | Description |
|---|---|
analytics.checkout.back_game | Player navigated back to the game |
analytics.checkout.back_store | Player navigated back to the store |
analytics.checkout.pageexit | Player exited the checkout page |
analytics.checkout.pagehide | Player navigated away from the checkout page |
analytics.checkout.pageshow | Player returned to the checkout page |
analytics.checkout.pageview | Player opened the checkout page |
analytics.checkout.submit_payment_form | Player submitted the payment form |
Need help?
Contact our integration team at integration@aghanim.com