Implementing Analytics

How to trigger analytics events in game code, and which obligatory (and optional) events to fire through Pley SDK AnalyticsKit.

Article: Full overview of analytics on Pley.

When launching a game through Pley, a set of analytics events is required for your game to function. This article is a how-to to implement fire those events correctly, as well as optional tracking.


Through the Pley SDK in the game code, you can trigger gameplay and player behavior-related events.

  1. Initialize Pley AnalyticsKit after the game and player data has been loaded by calling Pley.AnalyticsKit.Initialize(config);.
  2. Use Pley.AnalyticsKit.EVENT method to trigger analytics events in the game code, providing the correct data to the method.
  3. Fire the mandatory events through the Pley SDK's analytics kit (example below).
  4. Fire all optional gameplay events relevant to your game to the game code.
  5. Optional: Catch the events through the game site which has the Web Playable or Pley Web SDK embedded on it, and send them to the analytics service of your choice. (Read more here)

Example:

//Initialize analyticsKit with player properties
Pley.AnalyticsKit.Initialize(config);

//Example of how to fire an event
PleyResult result = Pley.AnalyticsKit.GameLoaded();

if (result != PleyResult.OK)
{
Debug.LogError("Failed to fire Pley analytics event game_loaded.");
}

/////////////////////////////////////////////////////////////////////////

//Example of how to fire an event with parameters
int playerLevel = 3;
PleyResult result = Pley.AnalyticsKit.LevelAdvanced(playerLevel);

if (result != PleyResult.OK)
{
Debug.LogError("Failed to fire Pley analytics event level_advanced");
}



Article: List of Pley Analytics Events