diff --git a/Runtime/GuruCore/Runtime/Analytics/Analytics.TemplateDefine.cs b/Runtime/GuruCore/Runtime/Analytics/Analytics.TemplateDefine.cs index 7a37c0f..d118287 100644 --- a/Runtime/GuruCore/Runtime/Analytics/Analytics.TemplateDefine.cs +++ b/Runtime/GuruCore/Runtime/Analytics/Analytics.TemplateDefine.cs @@ -1,3 +1,5 @@ +using JetBrains.Annotations; + namespace Guru { using System; @@ -153,8 +155,8 @@ namespace Guru dict[ParameterStep] = step.Value; if(score != null) dict[ParameterScore] = score.Value; - - if(extra != null) dict.AddRange(extra, isOverride:true); + if(extra != null) + dict.AddRange(extra, isOverride:true); LogEvent(EventLevelEnd, dict); @@ -162,7 +164,7 @@ namespace Guru { int lv = BPlay; if (lv == 0) lv = level; - LevelEndSuccess(itemCategory, lv, itemID); + LevelEndSuccess(lv, itemCategory, itemID); } } @@ -173,28 +175,29 @@ namespace Guru /// /// /// - /// - /// + /// + /// /// /// /// /// public static void LogLevelEnd(int level, string result, - string levelName = "", string itemCategory = "main", string itemId = "", + string levelName = "", string levelType = "main", string puzzleId = "", int? duration = null, int? step = null, int? score = null, Dictionary extra = null) { bool isSuccess = result.Equals("success"); var dict = new Dictionary() { - { ParameterItemCategory, itemCategory }, - { ParameterItemId, itemId }, + { ParameterItemCategory, levelType }, { ParameterLevelName, levelName }, { ParameterLevel, level }, { ParameterSuccess, isSuccess ? "true" : "false" }, { ParameterResult, result }, }; + if(!string.IsNullOrEmpty(puzzleId)) + dict[ParameterItemId] = puzzleId; if (duration != null) dict[ParameterDuration] = duration.Value; if(step != null) @@ -210,7 +213,7 @@ namespace Guru { int lv = BPlay; if (lv == 0) lv = level; - LevelEndSuccess(itemCategory, lv, itemId); + LevelEndSuccess(lv, levelType, puzzleId); } } @@ -219,10 +222,10 @@ namespace Guru /// /// 新用户通过第几关(仅记录前n关,根据项目自行确定,不区分关卡类型)[买量用] /// - /// + /// /// 关卡(从1开始) - /// /// 棋局id /图片id - public static void LevelEndSuccess(string itemCategory, int level, string itemID) + /// /// 棋局id /图片id + public static void LevelEndSuccess( int level, string levelType, string puzzleId) { if (level > GuruSettings.Instance.AnalyticsSetting.LevelEndSuccessNum) return; @@ -230,8 +233,9 @@ namespace Guru string eventName = $"level_end_success_{level}"; LogEvent(eventName,new Dictionary() { - { ParameterItemId, itemID }, - { ParameterItemCategory, itemCategory} + { ParameterLevel, level }, + { ParameterItemId, puzzleId }, + { ParameterItemCategory, levelType} }); }