From 8ea0171247a277945da2c6eb4d326f86fa83d083 Mon Sep 17 00:00:00 2001 From: huyufei Date: Mon, 13 May 2024 17:19:04 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyufei --- .../Analytics/Analytics.TemplateDefine.cs | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) 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} }); }