Skip to content

Log Events

Overview

This guide shows you how to log events in your game.

Events provide insight on what is happening in your game, such as user actions, system events, or errors.

SohaGame SDK automatically logs some events, but some events need you to integrate manually.

Before you begin

You will need to Integrate the SohaGame SDK for Android into your game.

List of events to integrate

Required events

1. create_character: Log this event when creating a character and entering the game successfully (Required)

SohaSDK.getInstance().logCreateCharacter(MainActivity.this, String.valueOf(areaId),
                        String.valueOf(character.getRoleId()),
                        character.getRoleName(), String.valueOf(character.getRoleLevel()));

Note: The create_character event is triggered only once when the character is successfully created.

2. set_role: Log this event after selecting character or level up (Required)

SohaSDK.getInstance().mapUserGame(MainActivity.this, String.valueOf(areaId),
                        String.valueOf(character.getRoleId()),
                        character.getRoleName(), String.valueOf(character.getRoleLevel()));

Make sure to provide all required information: AreaId, RoleID, RoleName, RoleLevel

Optional events

Custom event

 SohaSDK.getInstance().logCustomEvent("event_name");

CDN Download Event Tracking

The SDK provides predefined events to be triggered at the start and completion of CDN downloads. You need to trigger these two events manually using the logCustomEvent method. Logging these events provides valuable data insights to help optimize and improve the overall user experience.

// Logs a start event immediately,
// then logs a complete event after the CDN download is complete.
SohaSDK.getInstance().logCustomEvent(SohaTracker.SohaCDNDownloadStartEvent);

// Simulate the actual CDN download process
SohaSDK.getInstance().logCustomEvent(SohaTracker.SohaCDNDownloadCompleteEvent);

Log Events Flow

log events flow