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

List of events to integrate

Required events

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

[SohaKit logCreateCharacterWithName:role_name
                    roleID:role_id
                    roleLevel:role_level
                    serverID:server_id];

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)

[SohaKit mapUserGame:role_name
                    roleID:role_id 
                    roleLevel:role_level 
                    serverID:server_id];

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

Optional events

Custom event

[SohaKit logCustomEvent:@"<your_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.
[SohaKit logCustomEvent:SohaCDNDownloadStartEvent];

// Simulate the actual CDN download process
[SohaKit logCustomEvent:SohaCDNDownloadCompleteEvent];