Custom Events
For game-specific events not covered by the typed tracking methods.
Unity SDK
[System.Serializable]
public class QuestPayload
{
public string quest_id;
public string npc;
public int reward_xp;
}
var payload = new QuestPayload
{
quest_id = "main_quest_3",
npc = "merchant",
reward_xp = 500
};
string json = JsonUtility.ToJson(payload);
GameRebellion.TrackEvent("quest_accepted", json);
note
Unity's JsonUtility requires [Serializable] classes — anonymous types and dictionaries are not supported.
Server-to-Server
client.track_event("quest_accepted", {
"quest_id": "main_quest_3",
"npc": "merchant",
"reward_xp": 500
}, identifiers={"player_id": "player-12345"})
Best Practices
- Use descriptive event names —
quest_acceptedis better thanevent_1. - Keep payloads flat — avoid deeply nested objects.
- Be consistent — use the same field names across events for easier analysis.
- Prefer typed events when a built-in type exists — they have built-in validation and dashboard integration.