From 0c4d6b31e94ca4e9be383b91f426f2e289c776af Mon Sep 17 00:00:00 2001 From: huyufei Date: Wed, 29 May 2024 21:00:43 +0800 Subject: [PATCH] =?UTF-8?q?update=EF=BC=9A=20=E6=9B=B4=E6=96=B0=E6=89=93?= =?UTF-8?q?=E7=82=B9=E5=8F=82=E6=95=B0=E5=92=8C=E6=89=93=E7=82=B9=E5=BA=93?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --story=1020273 --user=yufei.hu 【中台】【BI】 中台打点标准化, 更新原有的打点和用户属性上报逻辑 https://www.tapd.cn/33527076/s/1147487 --- Runtime/Code/SDK/GuruSDK.Analytics.cs | 57 ++++++++++++++++----------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/Runtime/Code/SDK/GuruSDK.Analytics.cs b/Runtime/Code/SDK/GuruSDK.Analytics.cs index b3866f3..47bd7df 100644 --- a/Runtime/Code/SDK/GuruSDK.Analytics.cs +++ b/Runtime/Code/SDK/GuruSDK.Analytics.cs @@ -123,7 +123,7 @@ namespace Guru /// 扩展数据 public static void LogLevelEnd(int levelId, string result = EventLevelEndSuccess, string levelType = LevelTypeMain, string levelName = "", string puzzleId = "", - int? duration = null, int? step = null, int? score = null, Dictionary extra = null ) + int duration = 0, int? step = null, int? score = null, Dictionary extra = null ) { if (!IsInitialSuccess) { @@ -171,7 +171,7 @@ namespace Guru /// public static void LogLevelFail(int levelId, string levelType = LevelTypeMain, string levelName = "", string puzzleId = "", - int? duration = null, int? step = null, int? score = null , Dictionary extra = null) + int duration = 0, int? step = null, int? score = null , Dictionary extra = null) { LogLevelEnd(levelId, EventLevelEndFail, levelType, levelName, puzzleId, duration, step, score, extra); } @@ -181,7 +181,7 @@ namespace Guru /// public static void LogLevelFailExit(int levelId, string levelType = LevelTypeMain, string levelName = "", string puzzleId = "", - int? duration = null, int? step = null, int? score = null, Dictionary extra = null) + int duration = 0, int? step = null, int? score = null, Dictionary extra = null) { LogLevelEnd(levelId, EventLevelEndExit, levelType, levelName, puzzleId, duration, step, score, extra); } @@ -191,7 +191,7 @@ namespace Guru /// public static void LogLevelFailTimeout(int levelId, string levelType = LevelTypeMain, string levelName = "", string puzzleId = "", - int? duration = null, int? step = null, int? score = null, Dictionary extra = null) + int duration = 0, int? step = null, int? score = null, Dictionary extra = null) { LogLevelEnd(levelId, EventLevelEndTimeout, levelType, levelName, puzzleId, duration, step, score, extra); } @@ -286,17 +286,17 @@ namespace Guru public static void SetUID(string uid) { - SetUserProperty(Analytics.PropertyUserID, uid); + SetUserProperty(Consts.PropertyUserID, uid); } public static void SetUserBLevel(int blevel) { - SetUserProperty(Analytics.PropertyLevel, $"{blevel}"); + SetUserProperty(Consts.PropertyLevel, $"{blevel}"); } public static void SetUserBPlay(int bplay) { - SetUserProperty(Analytics.PropertyPlay, $"{bplay}"); + SetUserProperty(Consts.PropertyPlay, $"{bplay}"); } /// @@ -305,7 +305,7 @@ namespace Guru /// public static void SetUserTotalCoins(int totalCoins) { - SetUserProperty(Analytics.PropertyCoin, $"{totalCoins}"); + SetUserProperty(Consts.PropertyCoin, $"{totalCoins}"); } /// @@ -314,7 +314,7 @@ namespace Guru /// public static void SetUserFreeCoins(int freeCoins) { - SetUserProperty(Analytics.PropertyNonIAPCoin, $"{freeCoins}"); + SetUserProperty(Consts.PropertyNonIAPCoin, $"{freeCoins}"); } /// @@ -323,33 +323,44 @@ namespace Guru /// public static void SetUserPaidCoins(int paidCoins) { - SetUserProperty(Analytics.PropertyIAPCoin, $"{paidCoins}"); + SetUserProperty(Consts.PropertyIAPCoin, $"{paidCoins}"); } public static void SetUserExp(int exp) { - SetUserProperty(Analytics.PropertyExp, $"{exp}"); + SetUserProperty(Consts.PropertyExp, $"{exp}"); } public static void SetUserHp(int hp) { - SetUserProperty(Analytics.PropertyHp, $"{hp}"); + SetUserProperty(Consts.PropertyHp, $"{hp}"); } public static void SetUserGrade(int grade) { - SetUserProperty(Analytics.PropertyGrade, $"{grade}"); + SetUserProperty(Consts.PropertyGrade, $"{grade}"); } public static void SetUserIsIAP(bool isIapUser) { - SetUserProperty(Analytics.PropertyIsIAPUser, isIapUser? "true" : "false"); + SetUserProperty(Consts.PropertyIsIAPUser, isIapUser? "true" : "false"); } public static void SetFirstOpenTime(string timestamp) { SetUserProperty(Analytics.PropertyFirstOpenTime, timestamp); } + + public static void SetNotiPerm(string status) + { + SetUserProperty(Consts.PropertyNotiPerm, status); + } + + public static void SetATTStatus(string status) + { + SetUserProperty(Consts.PropertyATTStatus, status); + } + /// /// 初始化时调用一下所有的属性打点
@@ -395,11 +406,11 @@ namespace Guru #if UNITY_IOS if(!HasUserPropertyKey(Consts.PropertyATTStatus)) - SetUserProperty(Consts.PropertyATTStatus, "notDetermined"); + SetATTStatus("notDetermined"); // att_status #endif if(!HasUserPropertyKey(Consts.PropertyNotiPerm)) - SetUserProperty(Consts.PropertyNotiPerm, "not_determined"); + SetNotiPerm("not_determined"); // noti_perm } @@ -454,11 +465,11 @@ namespace Guru /// - /// 当付费页面打开时调用 + /// 当付费页面打开时调用 iap_imp /// - /// 付费页面名称, 默认为 Store + /// 付费页场景名称 /// 列表中首个商品的 ProductId - public static void OnIAPPageOpen(string scene = "Store", string productId = "") + public static void OnIAPImp(string scene, string productId = "") { if (string.IsNullOrEmpty(productId)) { @@ -468,11 +479,11 @@ namespace Guru } /// - /// 当付费页面关闭时调用 + /// 当付费页面关闭时调用 iap_close /// /// /// - public static void OnIAPPageClose(string scene = "Store", string productId = "") + public static void OnIAPClose(string scene, string productId = "") { if (string.IsNullOrEmpty(productId)) { @@ -483,7 +494,7 @@ namespace Guru } /// - /// 当点击 IAP 商品按钮的时候调用 + /// 当点击 IAP 商品按钮的时候调用 iap_clk /// /// /// @@ -852,7 +863,7 @@ namespace Guru #endregion - + #region Crashlytics 接口 public static void CrashLog(string message)