Last modified January 14, 2021 by Shelly Wolfe

How do I configure custom gameplay events?

This article provides an example of custom gameplay events. This example tracks the enemies that are killing game players.

Send a custom event called Gameplay.Player.Death with an Enemy payload containing the class of enemy who killed the player. On iOS, this looks like the following:

swrve_event(swrve, @"Gameplay.Player.Death", @"{ "Enemy" : "zombie" }");

Make sure you don’t send the enemy’s name (for example, zombie01, zombie02 or zombie03)—instead, send the enemy class. Sending the enemy name will quickly exhausts the 500 key/value pair payload limit for the event and you begin to lose visibility after 500 different enemies are killed.

If you have numerical IDs for your enemy classes (for example 0001, 0002 and 0003), add a string prefix to the number so that Swrve’s bucketing scheme does not kick in and group the payload values incorrectly. For example, 0001 would turn into Enemy-0001.

To interpret the data, navigate to the Events report, select the event Gameplay.Player.Death and then select the Enemy payload. A graph similar to the one below is displayed. The graph tells you how often your players are dying in addition to the enemies that are killing them.

Custom gameplay events showing enemy payload

The Payload Distribution chart is available by request on a per-app basis. If you would like to have it enabled for your app, contact your CSM at