Event Tracking
Level Progression Events
Level progression events are used to track and analyze the user's level behavior in the game, Including level start, level end, etc.
tip
Level Start Call: LevelStart
Level End Call: LevelEnd
- Level has ended with succ : Level_Success
- Level has ended with failed: Level_Fail
- Before level end, restart level. eg. click Retry button in the current level: Level_Retry
- Before level end, back to home page or level list. For example click back or quit buttons in current level: Level_Back
LevelStart
HCSDKManager.Instance.LevelEnter("1");
HCSDKManager.Instance.LevelEnter(1);
HCSDKManager.Instance.LevelEnter("S_1");
HCSDKManager.Instance.LevelEnter("S_1",new Dictionary<string, object>() {{ "s_id", 9 },{ "s_type","10"} });
Call LevelEnter
method when starting each level.
API:
void LevelEnter(int level,Dictionary<string, object> extraInfos = null);
void LevelEnter(string level,Dictionary<string, object> extraInfos = null);
Name | isRequired | Type | Description |
level | Y | int/string | level: current level id. You can get the specific values 「Level Progress Event Access」 on your game product requirement. |
extraInfos | N | Dictionary | Extended field You can get the specific values 「Level Progress Event Access」 on your game product requirement. |
LevelEnd
HCSDKManager.Instance.LevelEnd("1", StageResult.Level_Success);
HCSDKManager.Instance.LevelEnd(1, StageResult.Level_Success);
HCSDKManager.Instance.LevelEnd("S_1", StageResult.Level_Fail);
HCSDKManager.Instance.LevelEnd(3, StageResult.Level_Retry);
HCSDKManager.Instance.LevelEnd("S_2", StageResult.Level_Back);
HCSDKManager.Instance.LevelEnd("S_2", StageResult.Level_Success,new Dictionary<string, object>() {{ "s_id", 9 },{ "s_type","10"} });
Call LevelEnd
method when finish each level.
API:
void LevelEnd(int _level, StageResult _stageResult,Dictionary<string, object> extraInfos = null);
void LevelEnd(string _level, StageResult _stageResult,Dictionary<string, object> extraInfos = null);
Name | isRequired | Type | Description |
level | Y | int/string | level: current level id. You can get the specific values 「Level Progress Event Access」 on your game product requirement. |
stageResult | Y | StageResult | Level_Success: Level has ended with succ Level_Fail: Level has ended with failed Level_Retry: Before level end, restart level. eg. click Retry button in the current level Level_Back: Before level end, back to home page or level list. For example click back or quit buttons in current level |
extraInfos | N | Dictionary | Extended field You can get the specific values 「Level Progress Event Access」 on your game product requirement. |
Set public event attributes (for TD only)
Dictionary<string, object> superProperties = new Dictionary<string, object>();
superProperties["channel"] = "ta";//String
superProperties["age"] = 1;//int
superProperties["isSuccess"] = true;//bool
superProperties["birthday"] = DateTime.Now;//Time
superProperties["object"] = new Dictionary<string, object>() { { "key", "value" } };//Object
superProperties["object_arr"] = new List<object>() { new Dictionary<string, object>() { { "key", "value" } } };//Dictionary
superProperties["arr"] = new List<object>() { "value" };//Array
HCSDKManager.Instance.SetSuperProperties(superProperties);
Set user properties (for TD only)
Dictionary<string, object> userProperties = new Dictionary<string, object>();
userProperties["user_name"] = "TA";
HCSDKManager.Instance.SetUserProperties(userProperties);
User-defined event reporting
HCSDKManager.Instance.LogEvent("Event01");
HCSDKManager.Instance.LogEvent("Event02", "key01","value01",TrackEventPlatform.Firebase);
HCSDKManager.Instance.LogEvent("Event03", "key01", "value01", "key02", "value02",TrackEventPlatform.TD);
HCSDKManager.Instance.LogEvent("Event04", new Dictionary<string, object>() { { "key01", "value01" } });
Firebase/ TD is reported by default. If a statistical platform needs to be reported separately, use the TrackEventPlatform enumeration