update: 完善标准化打点接口, 补全自定义事件封装接口
--story=1020273 --user=yufei.hu 【中台】【BI】 中台打点标准化, 更新原有的打点和用户属性上报逻辑 https://www.tapd.cn/33527076/s/1147868hotfix/v1.0.12.2
							parent
							
								
									d70f9c3566
								
							
						
					
					
						commit
						31cb08b6df
					
				|  | @ -60,17 +60,17 @@ namespace Guru | |||
|         #region 游戏打点 | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 游戏启动打点 | ||||
|         /// 游戏启动打点 (level_start) | ||||
|         /// </summary> | ||||
|         /// <param name="levelId">关卡Id</param> | ||||
|         /// <param name="levelName">关卡名称: main_01_9001,  daily_challenge_81011</param> | ||||
|         /// <param name="levelType">关卡类型: 主线:main</param> | ||||
|         /// <param name="puzzleId">配置/谜题/图片/自定义Id: 101120</param> | ||||
|         /// <param name="itemId">配置/谜题/图片/自定义Id: 101120</param> | ||||
|         /// <param name="startType">关卡开始类型: play:开始游戏;replay:重玩;continue:继续游戏</param> | ||||
|         /// <param name="isReplay">是否重新开始: true/false</param> | ||||
|         /// <param name="extra">扩展数据</param> | ||||
|         public static void LogLevelStart(int levelId, string startType = EventLevelStartModePlay,  | ||||
|             string levelType = LevelTypeMain, string levelName = "", string puzzleId = "", | ||||
|             string levelType = LevelTypeMain, string levelName = "", string itemId = "", | ||||
|             bool isReplay = false, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             if (!IsInitialSuccess) | ||||
|  | @ -79,74 +79,80 @@ namespace Guru | |||
|                 return; | ||||
|             } | ||||
| 
 | ||||
|             Analytics.LogLevelStart(levelId, levelName, levelType, puzzleId, startType, isReplay, extra); | ||||
|             Analytics.LogLevelStart(levelId, levelName, levelType, itemId, startType, isReplay, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 游戏点击 Continue 继续游戏 | ||||
|         /// 游戏点击 Continue 继续游戏 (level_start) (continue) | ||||
|         /// </summary> | ||||
|         /// <param name="levelId"></param> | ||||
|         /// <param name="levelType"></param> | ||||
|         /// <param name="levelName"></param> | ||||
|         /// <param name="puzzleId"></param> | ||||
|         /// <param name="itemId"></param> | ||||
|         /// <param name="extra"></param> | ||||
|         public static void LogLevelContinue(int levelId, string levelType = LevelTypeMain, | ||||
|             string levelName = "", string puzzleId = "", Dictionary<string, object> extra = null) | ||||
|             string levelName = "", string itemId = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             LogLevelStart(levelId, EventLevelStartModeContinue, levelType, levelName, puzzleId,  true, extra:extra); | ||||
|             LogLevelStart(levelId, EventLevelStartModeContinue, levelType, levelName, itemId,  true, extra:extra); | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 游戏点击 Replay 重玩关卡 | ||||
|         /// 游戏点击 Replay 重玩关卡 (level_start) (replay) | ||||
|         /// </summary> | ||||
|         /// <param name="levelId"></param> | ||||
|         /// <param name="levelType"></param> | ||||
|         /// <param name="levelName"></param> | ||||
|         /// <param name="puzzleId"></param> | ||||
|         /// <param name="itemId"></param> | ||||
|         public static void LogLevelReplay(int levelId, string levelType = LevelTypeMain, | ||||
|             string levelName = "", string puzzleId = "", Dictionary<string, object> extra = null) | ||||
|             string levelName = "", string itemId = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             LogLevelStart(levelId, EventLevelStartModeReplay,levelType, levelName, puzzleId,  true, extra:extra); | ||||
|             LogLevelStart(levelId, EventLevelStartModeReplay,levelType, levelName, itemId,  true, extra:extra); | ||||
|         } | ||||
|          | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 关卡结束打点 | ||||
|         /// 关卡结束打点 (level_end) | ||||
|         /// </summary> | ||||
|         /// <param name="levelId">关卡Id</param> | ||||
|         /// <param name="result">success:成功;fail:失败;exit:退出;timeout:超时;replay:重玩...</param> | ||||
|         /// <param name="levelType">关卡类型: 主线:main</param> | ||||
|         /// <param name="levelName">关卡名称: main_01_9001,  daily_challenge_81011</param> | ||||
|         /// <param name="puzzleId">配置/谜题/图片/自定义Id: 101120</param> | ||||
|         /// <param name="itemId">配置/谜题/图片/自定义Id: 101120</param> | ||||
|         /// <param name="duration">关卡完成时长(单位:毫秒)</param> | ||||
|         /// <param name="step">步数(有则上报)</param> | ||||
|         /// <param name="score">分数(有则上报)</param> | ||||
|         /// <param name="extra">扩展数据</param> | ||||
|         public static void LogLevelEnd(int levelId,  string result = EventLevelEndSuccess, | ||||
|             string levelType = LevelTypeMain, string levelName = "", string puzzleId = "", | ||||
|             int duration = 0, int? step = null, int? score = null, Dictionary<string, object> extra = null ) | ||||
|         public static void LogLevelEnd(int levelId, string result = EventLevelEndSuccess, | ||||
|             string levelType = LevelTypeMain, string levelName = "", string itemId = "", | ||||
|             int duration = 0, int? step = null, int? score = null, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             if (!IsInitialSuccess) | ||||
|             { | ||||
|                 UnityEngine.Debug.LogError($"{Tag} :: LogLevelEnd {levelId} :: Please call <GuruSDK.Start()> first, before you call <LogLevelEnd>."); | ||||
|                 UnityEngine.Debug.LogError( | ||||
|                     $"{Tag} :: LogLevelEnd {levelId} :: Please call <GuruSDK.Start()> first, before you call <LogLevelEnd>."); | ||||
|                 return; | ||||
|             } | ||||
| 
 | ||||
|             // 优先打 level_end 事件 | ||||
|             Analytics.LogLevelEnd(levelId, result, levelName, levelType, itemId, duration, step, score, extra); | ||||
|              | ||||
|             // 自动记录关卡属性 | ||||
|             if (InitConfig.AutoRecordFinishedLevels) | ||||
|             { | ||||
|                 if(result == EventLevelEndSuccess){ | ||||
|                     if(levelType == LevelTypeMain) | ||||
|                 if (result == EventLevelEndSuccess) | ||||
|                 { | ||||
|                     if (levelType == LevelTypeMain) | ||||
|                     { | ||||
|                         if (levelId > Model.SuccessLevelId) Model.SuccessLevelId = levelId; // 自动记录关卡完成次数 | ||||
|                     } | ||||
| 
 | ||||
|                     Model.TotalPlayedCount++; // 自动记录关卡总次数 | ||||
| 
 | ||||
|                     Analytics.LevelEndSuccess(Model.TotalPlayedCount); // 自动 level_end_success | ||||
|                 } | ||||
|                  | ||||
| 
 | ||||
|                 Analytics.BLevel = Model.SuccessLevelId; // 记录 BLevel | ||||
|                 Analytics.BPlay = Model.TotalPlayedCount; // 记录 BPlay | ||||
|             } | ||||
|              | ||||
|             Analytics.LogLevelEnd(levelId, result, levelName, levelType, puzzleId, duration, step, score, extra); | ||||
|             | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|  | @ -158,47 +164,80 @@ namespace Guru | |||
|         /// <param name="result"></param> | ||||
|         /// <param name="duration"></param> | ||||
|         /// <param name="extra"></param> | ||||
|         public static void LevelFirstEnd(string levelType, string levelName, int level, | ||||
|             string result = EventLevelEndSuccess, int? duration = null, Dictionary<string, object> extra = null) | ||||
|         public static void LogLevelFirstEnd(string levelType, string levelName, int level, | ||||
|             string result = EventLevelEndSuccess, int duration = 0, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             Analytics.LevelFirstEnd(levelType, levelName, level, result, duration, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 关卡总胜利次数打点 (level_end_success_{num}) | ||||
|         /// </summary> | ||||
|         /// <param name="bPlay">完成总关数累计值</param> | ||||
|         /// /// <param name="extra">扩展参数</param> | ||||
|         public static void LogLevelEndSuccess(int bPlay, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             if (InitConfig.AutoRecordFinishedLevels) return; | ||||
|             Analytics.LevelEndSuccess(bPlay, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 游戏失败打点 | ||||
|         /// 需要为游戏记录详细的失败原因 | ||||
|         /// 游戏失败打点 (level_end) (fail) | ||||
|         /// </summary> | ||||
|         /// <param name="levelId"></param> | ||||
|         /// <param name="levelType"></param> | ||||
|         /// <param name="levelName"></param> | ||||
|         /// <param name="itemId"></param> | ||||
|         /// <param name="duration"></param> | ||||
|         /// <param name="step"></param> | ||||
|         /// <param name="score"></param> | ||||
|         /// <param name="extra"></param> | ||||
|         public static void LogLevelFail(int levelId, | ||||
|             string levelType = LevelTypeMain, string levelName = "", string puzzleId = "", | ||||
|             string levelType = LevelTypeMain, string levelName = "", string itemId = "", | ||||
|             int duration = 0, int? step = null, int? score = null , Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             LogLevelEnd(levelId, EventLevelEndFail, levelType, levelName, puzzleId, duration, step, score, extra); | ||||
|             LogLevelEnd(levelId, EventLevelEndFail, levelType, levelName, itemId, duration, step, score, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 因退出关卡导致游戏失败 | ||||
|         /// 游戏失败退出 (level_end) (exit)  | ||||
|         /// </summary> | ||||
|         /// <param name="levelId"></param> | ||||
|         /// <param name="levelType"></param> | ||||
|         /// <param name="levelName"></param> | ||||
|         /// <param name="itemId"></param> | ||||
|         /// <param name="duration"></param> | ||||
|         /// <param name="step"></param> | ||||
|         /// <param name="score"></param> | ||||
|         /// <param name="extra"></param> | ||||
|         public static void LogLevelFailExit(int levelId, | ||||
|             string levelType = LevelTypeMain, string levelName = "", string puzzleId = "", | ||||
|             string levelType = LevelTypeMain, string levelName = "", string itemId = "", | ||||
|             int duration = 0, int? step = null, int? score = null, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             LogLevelEnd(levelId, EventLevelEndExit, levelType, levelName, puzzleId, duration, step, score, extra); | ||||
|             LogLevelEnd(levelId, EventLevelEndExit, levelType, levelName, itemId, duration, step, score, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 因关卡超时导致游戏失败 | ||||
|         /// 关卡超时失败 (level_end) (timeout)  | ||||
|         /// </summary> | ||||
|         /// <param name="levelId"></param> | ||||
|         /// <param name="levelType"></param> | ||||
|         /// <param name="levelName"></param> | ||||
|         /// <param name="itemId"></param> | ||||
|         /// <param name="duration"></param> | ||||
|         /// <param name="step"></param> | ||||
|         /// <param name="score"></param> | ||||
|         /// <param name="extra"></param> | ||||
|         public static void LogLevelFailTimeout(int levelId, | ||||
|             string levelType = LevelTypeMain, string levelName = "", string puzzleId = "", | ||||
|             string levelType = LevelTypeMain, string levelName = "", string itemId = "", | ||||
|             int duration = 0, int? step = null, int? score = null, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             LogLevelEnd(levelId, EventLevelEndTimeout, levelType, levelName, puzzleId, duration, step, score, extra); | ||||
|             LogLevelEnd(levelId, EventLevelEndTimeout, levelType, levelName, itemId, duration, step, score, extra); | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 玩家(角色)升级事件 | ||||
|         /// 玩家(角色)升级事件 (level_up) | ||||
|         /// </summary> | ||||
|         /// <param name="playerLevel"></param> | ||||
|         /// <param name="characterName"></param> | ||||
|  | @ -214,20 +253,58 @@ namespace Guru | |||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 玩家解锁成就 | ||||
|         /// 玩家解锁成就 (unlock_achievement) | ||||
|         /// </summary> | ||||
|         /// <param name="achievementName"></param> | ||||
|         /// <param name="achievementId"></param> | ||||
|         /// <param name="extra">扩展数据</param> | ||||
|         public static void LogAchievement(string achievementName, Dictionary<string, object> extra = null) | ||||
|         public static void LogAchievement(string achievementId, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             if (!IsInitialSuccess) | ||||
|             { | ||||
|                 UnityEngine.Debug.LogError($"{Tag} :: LogAchievement {achievementName} :: Please call <GuruSDK.Start()> first, before you call <LogAchievement>."); | ||||
|                 UnityEngine.Debug.LogError($"{Tag} :: LogAchievement {achievementId} :: Please call <GuruSDK.Start()> first, before you call <LogAchievement>."); | ||||
|                 return; | ||||
|             } | ||||
|             Analytics.UnlockAchievement(achievementName, extra); | ||||
|             Analytics.UnlockAchievement(achievementId, extra); | ||||
|         } | ||||
|          | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 玩家体力变化 (hp_points) | ||||
|         /// </summary> | ||||
|         /// <param name="scene">场景</param> | ||||
|         /// <param name="hp">HP 增量值</param> | ||||
|         /// <param name="hpBefore">HP 初始值</param> | ||||
|         /// <param name="hpAfter">HP 结算值</param> | ||||
|         /// <param name="extra">额外数据</param> | ||||
|         public static void LogHpPoints(string scene, int hp, int hpBefore, int hpAfter, | ||||
|             Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             if (!IsInitialSuccess) | ||||
|             { | ||||
|                 UnityEngine.Debug.LogError( | ||||
|                     $"{Tag} :: LogHpPoints {hp} :: Please call <GuruSDK.Start()> first, before you call <LogHpChanged>."); | ||||
|                 return; | ||||
|             } | ||||
| 
 | ||||
|             var dict = new Dictionary<string, object>() | ||||
|             { | ||||
|                 [Consts.ParameterItemCategory] = scene, | ||||
|                 ["hp"] = hp, | ||||
|                 ["hp_before"] = hpBefore, | ||||
|                 ["hp_after"] = hpAfter, | ||||
|             }; | ||||
| 
 | ||||
|             if (extra != null) | ||||
|             { | ||||
|                 foreach (var k in extra.Keys) | ||||
|                 { | ||||
|                     dict[k] = extra[k]; | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             LogEvent(Consts.EventHpPoints, dict); | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         #endregion | ||||
| 
 | ||||
|         #region 用户属性 | ||||
|  | @ -291,28 +368,38 @@ namespace Guru | |||
| 
 | ||||
|         public static void SetUserBLevel(int blevel) | ||||
|         { | ||||
|             if (!InitConfig.AutoRecordFinishedLevels) | ||||
|             { | ||||
|                 Model.SuccessLevelId = blevel; | ||||
|             } | ||||
| 
 | ||||
|             SetUserProperty(Consts.PropertyLevel, $"{blevel}"); | ||||
|         } | ||||
|          | ||||
|         public static void SetUserBPlay(int bplay) | ||||
|         { | ||||
|             if (!InitConfig.AutoRecordFinishedLevels) | ||||
|             { | ||||
|                 Model.TotalPlayedCount = bplay; | ||||
|             } | ||||
|              | ||||
|             SetUserProperty(Consts.PropertyPlay, $"{bplay}"); | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 上报用户全部的 Coin (当前值) | ||||
|         /// </summary> | ||||
|         /// <param name="totalCoins"></param> | ||||
|         public static void SetUserTotalCoins(int totalCoins) | ||||
|         /// <param name="coins"></param> | ||||
|         public static void SetUserCoins(int coins) | ||||
|         { | ||||
|             SetUserProperty(Consts.PropertyCoin, $"{totalCoins}");         | ||||
|             SetUserProperty(Consts.PropertyCoin, $"{coins}");         | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 上报用户免费金币的 数量 (累加值) | ||||
|         /// </summary> | ||||
|         /// <param name="freeCoins"></param> | ||||
|         public static void SetUserFreeCoins(int freeCoins) | ||||
|         public static void SetUserNonIapCoins(int freeCoins) | ||||
|         { | ||||
|             SetUserProperty(Consts.PropertyNonIAPCoin, $"{freeCoins}");         | ||||
|         } | ||||
|  | @ -390,10 +477,10 @@ namespace Guru | |||
|                 SetUserPaidCoins(0); // iap_coin | ||||
|              | ||||
|             if(!HasUserPropertyKey(Consts.PropertyNonIAPCoin))  | ||||
|                 SetUserFreeCoins(0); // non_iap_coin | ||||
|                 SetUserNonIapCoins(0); // non_iap_coin | ||||
|              | ||||
|             if(!HasUserPropertyKey(Consts.PropertyCoin))  | ||||
|                 SetUserTotalCoins(0);// coin | ||||
|                 SetUserCoins(0);// coin | ||||
| 
 | ||||
|             if (!HasUserPropertyKey(Consts.PropertyGrade)) | ||||
|                 SetUserGrade(0); // grade | ||||
|  | @ -465,42 +552,34 @@ namespace Guru | |||
|          | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 当付费页面打开时调用 iap_imp | ||||
|         /// 当付费页面打开时调用 (iap_imp) | ||||
|         /// </summary> | ||||
|         /// <param name="scene">付费页场景名称</param> | ||||
|         /// <param name="productId">列表中首个商品的 ProductId </param> | ||||
|         public static void OnIAPImp(string scene, string productId = "") | ||||
|         public static void LogIAPImp(string scene, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             if (string.IsNullOrEmpty(productId)) | ||||
|             { | ||||
|                 productId = TryGetFirstProductId(); | ||||
|             } | ||||
|             Analytics.IAPImp(scene, productId); | ||||
|             Analytics.IAPImp(scene, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 当付费页面关闭时调用 iap_close | ||||
|         /// 当付费页面关闭时调用 (iap_close) | ||||
|         /// </summary> | ||||
|         /// <param name="scene"></param> | ||||
|         /// <param name="productId"></param> | ||||
|         public static void OnIAPClose(string scene, string productId = "") | ||||
|         public static void LogIAPClose(string scene, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             if (string.IsNullOrEmpty(productId)) | ||||
|             { | ||||
|                 productId = TryGetCurrentProductId(); | ||||
|             } | ||||
| 
 | ||||
|             Analytics.IAPClose(scene, productId); | ||||
|             Analytics.IAPClose(scene, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 当点击 IAP 商品按钮的时候调用 iap_clk | ||||
|         /// 当点击 IAP 商品按钮的时候调用 (iap_clk) | ||||
|         /// </summary> | ||||
|         /// <param name="scene"></param> | ||||
|         /// <param name="productId"></param> | ||||
|         public static void OnIAPClick(string scene = "", string productId = "") | ||||
|         /// <param name="offerId"></param> | ||||
|         public static void LogIAPClick(string scene, string productId, string basePlan = "", string offerId = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             Analytics.IAPClick(scene, productId); | ||||
|             Analytics.IAPClick(scene, productId, basePlan, offerId, extra); | ||||
|         } | ||||
|          | ||||
|         #endregion | ||||
|  | @ -516,7 +595,8 @@ namespace Guru | |||
|          | ||||
|         //---------------------------------------- EARN ----------------------------------------  | ||||
|         /// <summary> | ||||
|         /// 基础收入接口. 可直接调用此接口上报相关参数 | ||||
|         /// 基础收入接口 (earn_virtual_currency) | ||||
|         /// 可直接调用此接口上报相关参数 | ||||
|         /// 获取虚拟货币/道具.  | ||||
|         /// 基础接口, 不推荐项目组直接调用 | ||||
|         /// 请直接调用其他对应场景的统计接口 | ||||
|  | @ -528,7 +608,7 @@ namespace Guru | |||
|         /// <param name="levelName">当前关卡或者人物等级名称</param> | ||||
|         /// <param name="itemName">购买道具名称</param> | ||||
|         /// <param name="scene">购买场景如 Store, Workbench, Sign, Ads....</param> | ||||
|         public static void EarnVirtualCurrency(string currencyName,  | ||||
|         public static void LogEarnVirtualCurrency(string currencyName,  | ||||
|             int value, int balance,  | ||||
|             string category = "", string itemName = "", | ||||
|             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | ||||
|  | @ -539,7 +619,7 @@ namespace Guru | |||
|          | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 赚取组合: 货币+道具 | ||||
|         /// 赚取组合: 货币+道具 (earn_virtual_currency) (props) | ||||
|         /// </summary> | ||||
|         /// <param name="currencyName"></param> | ||||
|         /// <param name="value"></param> | ||||
|  | @ -549,7 +629,7 @@ namespace Guru | |||
|         /// <param name="props"></param> | ||||
|         /// <param name="levelName"></param> | ||||
|         /// <param name="scene"></param> | ||||
|         private static void EarnVirtualCurrencyAndProps(string currencyName,  | ||||
|         private static void LogEarnVirtualCurrencyAndProps(string currencyName,  | ||||
|             int value = 0, int balance = 0, | ||||
|             string category = "", string itemName = "", | ||||
|             string levelName = "", string scene = Consts.ParameterDefaultScene,   | ||||
|  | @ -558,7 +638,7 @@ namespace Guru | |||
|             //---- Currency ----- | ||||
|             if (value > 0) | ||||
|             { | ||||
|                 EarnVirtualCurrency(currencyName, value, balance, category, itemName, levelName, scene, extra); | ||||
|                 LogEarnVirtualCurrency(currencyName, value, balance, category, itemName, levelName, scene, extra); | ||||
|             } | ||||
|             //---- Props -------- | ||||
|             if (null != props) | ||||
|  | @ -566,14 +646,14 @@ namespace Guru | |||
|                 int i = 0; | ||||
|                 while (i < props.Length) | ||||
|                 { | ||||
|                     EarnVirtualCurrency(props[i], 1, 0, category, itemName, levelName, scene, extra); | ||||
|                     LogEarnVirtualCurrency(props[i], 1, 0, category, itemName, levelName, scene, extra); | ||||
|                     i++; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 签到奖励. 获得货币/道具 | ||||
|         /// 签到奖励. 获得货币/道具 (earn_virtual_currency) (reward:sign) | ||||
|         /// <li>通常类型: Coin 收入 </li> | ||||
|         /// <li>特殊类型: Coin + Props (道具列表) </li> | ||||
|         /// <li>特殊类型: Props (道具列表) </li> | ||||
|  | @ -584,19 +664,19 @@ namespace Guru | |||
|         /// <param name="levelName">当前关卡名称</param> | ||||
|         /// <param name="scene">应用场景</param> | ||||
|         /// <param name="props">获取的道具名称列表</param> | ||||
|         public static void EarnVirtualCurrencyBySign(string currencyName,  | ||||
|         public static void LogEarnVirtualCurrencyBySign(string currencyName,  | ||||
|             int value = 0, int balance = 0, string levelName = "",  | ||||
|             string scene = "home", string[] props = null, Dictionary<string, object> extra = null) | ||||
|             string scene = "home_page", string[] props = null, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             string category = Consts.CurrencyCategoryReward; | ||||
|             string itemName = "sign"; | ||||
| 
 | ||||
|             EarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | ||||
|             LogEarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// IAP 付费购买. 获得货币/道具 | ||||
|         /// IAP 付费购买. 获得货币/道具 (earn_virtual_currency) (iap_buy:sku) | ||||
|         /// <li>通常类型: Coin 收入 </li> | ||||
|         /// <li>特殊类型: Coin + Props (道具列表) </li> | ||||
|         /// <li>特殊类型: Props (道具列表) </li>  | ||||
|  | @ -608,18 +688,18 @@ namespace Guru | |||
|         /// <param name="levelName">当前关卡名称</param> | ||||
|         /// <param name="scene">应用场景</param> | ||||
|         /// <param name="props">获取的道具名称列表</param> | ||||
|         public static void EarnVirtualCurrencyByIAP(string currencyName, string productId,  | ||||
|         public static void LogEarnVirtualCurrencyByIAP(string currencyName, string productId,  | ||||
|             int value = 0, int balance = 0, string levelName = "",  | ||||
|             string scene = "store", string[] props = null, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             string category = Consts.CurrencyCategoryIAP; | ||||
|             // string itemName = productId; | ||||
|             string itemName = "sku"; | ||||
|             EarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | ||||
|             LogEarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 看广告获取到货币/道具 | ||||
|         /// 看广告获取到货币/道具 (earn_virtual_currency) (reward:ads) | ||||
|         /// <li>通常类型: Coin 收入 </li> | ||||
|         /// <li>特殊类型: Coin + Props (道具列表) </li> | ||||
|         /// <li>特殊类型: Props (道具列表) </li>  | ||||
|  | @ -630,17 +710,17 @@ namespace Guru | |||
|         /// <param name="levelName">当前关卡名称</param> | ||||
|         /// <param name="scene">应用场景</param> | ||||
|         /// <param name="props">获取的道具名称列表</param> | ||||
|         public static void EarnVirtualCurrencyByAds(string currencyName,  | ||||
|         public static void LogEarnVirtualCurrencyByAds(string currencyName,  | ||||
|             int value = 0, int balance = 0, string levelName = "",  | ||||
|             string scene = "store", string[] props = null, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             string category = Consts.CurrencyCategoryReward; | ||||
|             string itemName = "ads"; | ||||
|             EarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | ||||
|             LogEarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 使用了金币半价 + 看广告获取到货币/道具 | ||||
|         /// 使用了金币半价 + 看广告获取到货币/道具 (earn_virtual_currency) (bonus:ads) | ||||
|         /// <li>通常类型: Coin 收入 </li> | ||||
|         /// <li>特殊类型: Coin + Props (道具列表) </li> | ||||
|         /// <li>特殊类型: Props (道具列表) </li>  | ||||
|  | @ -651,17 +731,17 @@ namespace Guru | |||
|         /// <param name="levelName">当前关卡名称</param> | ||||
|         /// <param name="scene">应用场景</param> | ||||
|         /// <param name="props">获取的道具名称列表</param> | ||||
|         public static void EarnVirtualCurrencyByPaidAds(string currencyName,  | ||||
|         public static void LogEarnVirtualCurrencyByPaidAds(string currencyName,  | ||||
|             int value = 0, int balance = 0, string levelName = "",  | ||||
|             string scene = Consts.ParameterDefaultScene, string[] props = null, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             string category = Consts.CurrencyCategoryBonus; | ||||
|             string itemName = "ads"; | ||||
|             EarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | ||||
|             LogEarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 过关奖励获取到货币/道具 | ||||
|         /// 过关奖励获取到货币/道具 (earn_virtual_currency) (reward:level)  | ||||
|         /// <li>通常类型: Coin 收入 </li> | ||||
|         /// <li>特殊类型: Coin + Props (道具列表) </li> | ||||
|         /// <li>特殊类型: Props (道具列表) </li>  | ||||
|  | @ -672,18 +752,19 @@ namespace Guru | |||
|         /// <param name="levelName">当前关卡名称</param> | ||||
|         /// <param name="scene">应用场景</param> | ||||
|         /// <param name="props">获取的道具名称列表</param> | ||||
|         public static void EarnVirtualCurrencyByLevelComplete(string currencyName,  | ||||
|         public static void LogEarnVirtualCurrencyByLevelComplete(string currencyName,  | ||||
|             int value = 0, int balance = 0, string levelName = "",  | ||||
|             string scene = "store", string[] props = null, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             string category = Consts.CurrencyCategoryReward; | ||||
|             string itemName = "level"; | ||||
|             EarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | ||||
|             LogEarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 通过使用 Currency 购买获得 Prop (记录 Prop 增加的打点, 消费游戏内货币) | ||||
|         /// 通过使用 Currency 购买获得 Prop (earn_virtual_currency) (reward:level)  | ||||
|         /// 记录 Prop 增加的打点, 消费游戏内货币 | ||||
|         /// </summary> | ||||
|         /// <param name="currencyName">货币名称</param> | ||||
|         /// <param name="props">获取的道具名称列表</param> | ||||
|  | @ -691,17 +772,17 @@ namespace Guru | |||
|         /// <param name="value">赚取金额</param> | ||||
|         /// <param name="balance">货币总量(累加后)</param> | ||||
|         /// <param name="levelName">当前关卡名称</param> | ||||
|         public static void EarnPropsByVirtualCurrency(string currencyName, string[] props, | ||||
|         public static void LogEarnPropsByVirtualCurrency(string currencyName, string[] props, | ||||
|             string scene = Consts.ParameterDefaultScene, | ||||
|             int value = 1, int balance = 0, string levelName = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             string category = Consts.CurrencyCategoryIGC; | ||||
|             string itemName = currencyName; | ||||
|             EarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | ||||
|             LogEarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 通过道具交换/合成或得了其他道具 | ||||
|         /// 通过道具交换/合成或得了其他道具 (earn_virtual_currency) (igb:coin)  | ||||
|         /// </summary> | ||||
|         /// <param name="propName"></param> | ||||
|         /// <param name="otherName"></param> | ||||
|  | @ -709,17 +790,17 @@ namespace Guru | |||
|         /// <param name="value"></param> | ||||
|         /// <param name="balance"></param> | ||||
|         /// <param name="levelName"></param> | ||||
|         public static void EarnPropByProp(string propName, string otherName, | ||||
|         public static void LogEarnPropByProp(string propName, string otherName, | ||||
|             string scene = Consts.ParameterDefaultScene, | ||||
|             int value = 1, int balance = 0, string levelName = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             string category = Consts.CurrencyCategoryIGB; | ||||
|             EarnVirtualCurrency(propName, value, balance, category, otherName, levelName, scene, extra); | ||||
|             LogEarnVirtualCurrency(propName, value, balance, category, otherName, levelName, scene, extra); | ||||
|         } | ||||
|          | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 通过转盘或者抽奖, 获取货币/道具 | ||||
|         /// 通过转盘或者抽奖, 获取货币/道具 (earn_virtual_currency) (igb:lottery)  | ||||
|         /// <li>通常类型: Coin 收入 </li> | ||||
|         /// <li>特殊类型: Coin + Props (道具列表) </li> | ||||
|         /// <li>特殊类型: Props (道具列表) </li>  | ||||
|  | @ -730,13 +811,13 @@ namespace Guru | |||
|         /// <param name="levelName">当前关卡名称</param> | ||||
|         /// <param name="scene">应用场景</param> | ||||
|         /// <param name="props">获取的道具名称列表</param> | ||||
|         public static void EarnVirtualCurrencyByLottery(string currencyName,  | ||||
|         public static void LogEarnVirtualCurrencyByLottery(string currencyName,  | ||||
|             int value = 0, int balance = 0, string levelName = "",  | ||||
|             string scene = "store", string[] props = null, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             string category = Consts.CurrencyCategoryIGB; | ||||
|             string itemName = "lottery"; | ||||
|             EarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | ||||
|             LogEarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | ||||
|         } | ||||
|          | ||||
|          | ||||
|  | @ -744,7 +825,7 @@ namespace Guru | |||
| 
 | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 基础花费虚拟货币/道具 | ||||
|         /// 基础花费虚拟货币/道具 (spend_virtual_currency) | ||||
|         /// 基础接口, 不推荐项目组直接调用 | ||||
|         /// 请直接调用其他对应场景的统计接口 | ||||
|         /// </summary> | ||||
|  | @ -755,7 +836,7 @@ namespace Guru | |||
|         /// <param name="levelName">当前关卡或者人物等级名称</param> | ||||
|         /// <param name="itemName">购买道具名称</param> | ||||
|         /// <param name="scene">购买场景如 Store, Workbench, Sign, Ads....</param> | ||||
|         public static void SpendVirtualCurrency(string currencyName, int value, int balance, string category = "", string itemName = "", | ||||
|         public static void LogSpendVirtualCurrency(string currencyName, int value, int balance, string category = "", string itemName = "", | ||||
|             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             Analytics.SpendVirtualCurrency(currencyName, value, balance, category, itemName, levelName, scene, extra); | ||||
|  | @ -763,7 +844,7 @@ namespace Guru | |||
| 
 | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 消耗货币购买道具 | ||||
|         /// 消耗货币购买道具 (spend_virtual_currency) (props) | ||||
|         /// </summary> | ||||
|         /// <param name="currencyName"></param> | ||||
|         /// <param name="prop"></param> | ||||
|  | @ -771,15 +852,15 @@ namespace Guru | |||
|         /// <param name="balance"></param> | ||||
|         /// <param name="levelName"></param> | ||||
|         /// <param name="scene"></param> | ||||
|         public static void SpendVirtualCurrencyWithProp(string currencyName, string prop, | ||||
|         public static void LogSpendVirtualCurrencyWithProp(string currencyName, string prop, | ||||
|             int value, int balance, | ||||
|             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             SpendVirtualCurrencyWithProps(currencyName, new string[] {prop}, value, balance, levelName, scene, extra); | ||||
|             LogSpendVirtualCurrencyWithProps(currencyName, new string[] {prop}, value, balance, levelName, scene, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 消耗货币购买道具 (含多个) | ||||
|         /// 消耗货币购买道具 (含多个) (spend_virtual_currency) (props) | ||||
|         /// </summary> | ||||
|         /// <param name="currencyName"></param> | ||||
|         /// <param name="props"></param> | ||||
|  | @ -787,24 +868,24 @@ namespace Guru | |||
|         /// <param name="balance"></param> | ||||
|         /// <param name="levelName"></param> | ||||
|         /// <param name="scene"></param> | ||||
|         public static void SpendVirtualCurrencyWithProps(string currencyName, string[] props, | ||||
|         public static void LogSpendVirtualCurrencyWithProps(string currencyName, string[] props, | ||||
|             int value, int balance,  | ||||
|             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             string category = Consts.CurrencyCategoryProp; | ||||
|             string category = Consts.CurrencyCategoryProps; | ||||
|             if (props != null && props.Length > 0) | ||||
|             { | ||||
|                 int i = 0; | ||||
|                 while (i < props.Length) | ||||
|                 { | ||||
|                     SpendVirtualCurrency(currencyName, value, balance, category, props[i], levelName, scene, extra);  | ||||
|                     LogSpendVirtualCurrency(currencyName, value, balance, category, props[i], levelName, scene, extra);  | ||||
|                     i++; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 消耗货币购买礼包或组合 | ||||
|         /// 消耗货币购买礼包或组合 (spend_virtual_currency) (bundle) | ||||
|         /// </summary> | ||||
|         /// <param name="currencyName"></param> | ||||
|         /// <param name="bundle"></param> | ||||
|  | @ -812,15 +893,15 @@ namespace Guru | |||
|         /// <param name="balance"></param> | ||||
|         /// <param name="levelName"></param> | ||||
|         /// <param name="scene"></param> | ||||
|         public static void SpendVirtualCurrencyWithBundle(string currencyName, string bundle, | ||||
|         public static void LogSpendVirtualCurrencyWithBundle(string currencyName, string bundle, | ||||
|             int value, int balance, | ||||
|             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             SpendVirtualCurrencyWithBundles(currencyName, new string[] {bundle}, value, balance, levelName, scene, extra); | ||||
|             LogSpendVirtualCurrencyWithBundles(currencyName, new string[] {bundle}, value, balance, levelName, scene, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 消耗货币购买礼包或组合  (含多个) | ||||
|         /// 消耗货币购买礼包或组合 (复数) (spend_virtual_currency) (bundle) | ||||
|         /// </summary> | ||||
|         /// <param name="currencyName"></param> | ||||
|         /// <param name="bundles"></param> | ||||
|  | @ -828,7 +909,7 @@ namespace Guru | |||
|         /// <param name="balance"></param> | ||||
|         /// <param name="levelName"></param> | ||||
|         /// <param name="scene"></param> | ||||
|         public static void SpendVirtualCurrencyWithBundles(string currencyName, string[] bundles, | ||||
|         public static void LogSpendVirtualCurrencyWithBundles(string currencyName, string[] bundles, | ||||
|             int value, int balance,  | ||||
|             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|  | @ -838,14 +919,14 @@ namespace Guru | |||
|                 int i = 0; | ||||
|                 while (i < bundles.Length) | ||||
|                 { | ||||
|                     SpendVirtualCurrency(currencyName, value, balance, category, bundles[i], levelName, scene, extra);  | ||||
|                     LogSpendVirtualCurrency(currencyName, value, balance, category, bundles[i], levelName, scene, extra);  | ||||
|                     i++; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 消耗物品, 交换其他物品 | ||||
|         /// 消耗物品, 交换其他物品 (spend_virtual_currency) (prop) | ||||
|         /// </summary> | ||||
|         /// <param name="currencyName"></param> | ||||
|         /// <param name="bundles"></param> | ||||
|  | @ -853,12 +934,267 @@ namespace Guru | |||
|         /// <param name="balance"></param> | ||||
|         /// <param name="levelName"></param> | ||||
|         /// <param name="scene"></param> | ||||
|         public static void SpendPropWithProp(string propName, string otherName, | ||||
|         public static void LogSpendPropWithProp(string propName, string otherName, | ||||
|             int value, int balance,  | ||||
|             string levelName = "", string scene = "", string extraCategory = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             string category = string.IsNullOrEmpty(extraCategory) ? Consts.CurrencyCategoryProp : extraCategory; | ||||
|             SpendVirtualCurrency(propName, value, balance, category, otherName, levelName, scene, extra);  | ||||
|             LogSpendVirtualCurrency(propName, value, balance, category, otherName, levelName, scene, extra);  | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         #endregion | ||||
| 
 | ||||
|         #region ATT 二次引导弹窗 | ||||
|          | ||||
|         /// <summary> | ||||
|         /// ATT 二次引导弹窗展示 (att_reguide_imp) | ||||
|         /// </summary> | ||||
|         /// <param name="type">引导样式名称</param> | ||||
|         /// <param name="showTimes">第几次展示</param> | ||||
|         /// <param name="installDays">举例安装日期的天数</param> | ||||
|         /// <param name="extra">扩展数据</param> | ||||
|         public static void LogAttReguideImp(string type,  | ||||
|             int showTimes = 1, int installDays = 0, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             var dict = new Dictionary<string, object>() | ||||
|             { | ||||
|                 ["type"] = type, | ||||
|                 ["show_times"] = showTimes, | ||||
|                 ["install_days"] = installDays, | ||||
|             }; | ||||
| 
 | ||||
|             if (extra != null) dict = GuruSDKUtils.MergeDictionary(dict, extra); | ||||
|             LogEvent(Consts.EventAttReguideImp, dict); | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         /// ATT 二次引导弹窗点击 (att_reguide_clk) | ||||
|         /// </summary> | ||||
|         /// <param name="type">引导样式名称</param> | ||||
|         /// <param name="showTimes">第几次展示</param> | ||||
|         /// <param name="installDays">举例安装日期的天数</param> | ||||
|         /// <param name="action">点击引导页的动作:dissmiss/go</param> | ||||
|         /// <param name="extra">扩展数据</param> | ||||
|         public static void LogAttReguideClick(string type, string action,  | ||||
|             int showTimes = 1, int installDays = 0, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             var dict = new Dictionary<string, object>() | ||||
|             { | ||||
|                 ["type"] = type, | ||||
|                 ["show_times"] = showTimes, | ||||
|                 ["install_days"] = installDays, | ||||
|                 ["action"] = action, | ||||
|             }; | ||||
| 
 | ||||
|             if (extra != null) dict = GuruSDKUtils.MergeDictionary(dict, extra); | ||||
|             LogEvent(Consts.EventAttReguideClk, dict); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// ATT 二次引导弹窗展示结果 (att_reguide_result) | ||||
|         /// </summary> | ||||
|         /// <param name="type">引导样式名称</param> | ||||
|         /// <param name="showTimes">第几次展示</param> | ||||
|         /// <param name="installDays">举例安装日期的天数</param> | ||||
|         /// <param name="action">点击引导页的动作:dissmiss/go</param> | ||||
|         /// <param name="result">结果字段:authorized, denied, restricted, notDetermined</param> | ||||
|         /// <param name="extra">扩展数据</param> | ||||
|         public static void LogAttReguideResult(string type, string action, string result,  | ||||
|             int showTimes = 1, int installDays = 0, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             var dict = new Dictionary<string, object>() | ||||
|             { | ||||
|                 ["type"] = type, | ||||
|                 ["show_times"] = showTimes, | ||||
|                 ["install_days"] = installDays, | ||||
|                 ["action"] = action, | ||||
|                 [Consts.ParameterItemCategory] = result, | ||||
|             }; | ||||
| 
 | ||||
|             if (extra != null) dict = GuruSDKUtils.MergeDictionary(dict, extra); | ||||
|             LogEvent(Consts.EventAttReguideResult, dict); | ||||
|         } | ||||
|          | ||||
| 
 | ||||
|         #endregion | ||||
|          | ||||
|         #region 教程引导 | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 教程开始 | ||||
|         /// </summary> | ||||
|         /// <param name="extra">扩展数据</param> | ||||
|         public static void LogTutorialBegin(Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             LogEvent(Consts.EventTutorialBegin, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 教程开始 | ||||
|         /// </summary> | ||||
|         /// <param name="step">教程步骤</param> | ||||
|         /// <param name="extra">扩展数据</param> | ||||
|         public static void LogTutorialImp(int step, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             string key = Consts.EventTutorialImp.Replace("{0}", step.ToString()); | ||||
|             LogEvent(key, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 教程开始 | ||||
|         /// </summary> | ||||
|         /// <param name="step">教程步骤</param> | ||||
|         /// <param name="extra">扩展数据</param> | ||||
|         public static void LogTutorialNextClick(int step, Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             string key = Consts.EventTutorialNextClick.Replace("{0}", step.ToString()); | ||||
|             LogEvent(key, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 教程结束 | ||||
|         /// </summary> | ||||
|         /// <param name="extra">扩展数据</param> | ||||
|         public static void LogTutorialComplete(Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             LogEvent(Consts.EventTutorialComplete, extra); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 教程页面关闭 | ||||
|         /// </summary> | ||||
|         /// <param name="extra">扩展数据</param> | ||||
|         public static void LogTutorialClose(Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             LogEvent(Consts.EventTutorialClose, extra); | ||||
|         } | ||||
|         #endregion | ||||
| 
 | ||||
|         #region 消息权限弹窗打点 | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 通知栏请求权限展示时触发 (noti_perm_imp) | ||||
|         /// </summary> | ||||
|         /// <param name="style">弹窗样式</param> | ||||
|         /// <param name="requestTimes">请求弹窗的次数</param> | ||||
|         /// <param name="showTimes">展现弹窗的次数</param> | ||||
|         /// <param name="deniedTimes">点击 deny 的次数</param> | ||||
|         /// <param name="promptTrigger">弹窗触发来源</param> | ||||
|         /// <param name="scene">弹窗场景</param> | ||||
|         /// <param name="extra">扩展参数</param> | ||||
|         public static void LogNotiPermImp(int requestTimes,  int showTimes, int deniedTimes, string promptTrigger,string style = "default",  string scene = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             var dict = new Dictionary<string, object>() | ||||
|             { | ||||
|                 [Consts.ParameterItemCategory] = style, | ||||
|                 ["request_times"] = requestTimes, | ||||
|                 ["show_times"] = showTimes, | ||||
|                 ["denied_times"] = deniedTimes, | ||||
|                 ["prompt_trigger"] = promptTrigger, | ||||
|             }; | ||||
| 
 | ||||
|             if (!string.IsNullOrEmpty(scene)) | ||||
|                 dict[Consts.ParameterItemName] = scene; | ||||
| 
 | ||||
|             if (extra != null) dict = GuruSDKUtils.MergeDictionary(dict, extra); | ||||
|             LogEvent(Consts.EventNotiPermImp, dict); | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 得到权限结果时触发 (noti_perm_result) | ||||
|         /// </summary> | ||||
|         /// <param name="requestTimes"></param> | ||||
|         /// <param name="showTimes"></param> | ||||
|         /// <param name="deniedTimes"></param> | ||||
|         /// <param name="result"></param> | ||||
|         /// <param name="promptTrigger"></param> | ||||
|         /// <param name="style"></param> | ||||
|         /// <param name="scene"></param> | ||||
|         /// <param name="extra"></param> | ||||
|         public static void LogNotiPermResult( int requestTimes,  int showTimes, int deniedTimes, string result, string promptTrigger, string style = "default", string scene = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             var dict = new Dictionary<string, object>() | ||||
|             { | ||||
|                 ["request_times"] = requestTimes, | ||||
|                 ["show_times"] = showTimes, | ||||
|                 ["denied_times"] = deniedTimes, | ||||
|                 ["prompt_trigger"] = promptTrigger, | ||||
|                 ["result"] = result, | ||||
|                 [Consts.ParameterItemCategory] = style, | ||||
|             }; | ||||
| 
 | ||||
|             if (!string.IsNullOrEmpty(scene)) | ||||
|                 dict[Consts.ParameterItemName] = scene; | ||||
| 
 | ||||
|             if (extra != null) dict = GuruSDKUtils.MergeDictionary(dict, extra); | ||||
|             LogEvent(Consts.EventNotiPermResult, dict); | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 说明性通知栏权限引导展示时触发 (noti_perm_rationale_imp) | ||||
|         /// </summary> | ||||
|         /// <param name="pageName">引导页的名称,自定义</param> | ||||
|         /// <param name="scene"></param> | ||||
|         /// <param name="extra"></param> | ||||
|         public static void LogNotiPermRationaleImp(string pageName, string scene = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             var dict = new Dictionary<string, object>() | ||||
|             { | ||||
|                 [Consts.ParameterItemCategory] = pageName, | ||||
|             }; | ||||
| 
 | ||||
|             if (!string.IsNullOrEmpty(scene)) | ||||
|                 dict[Consts.ParameterItemName] = scene; | ||||
| 
 | ||||
|             if (extra != null) dict = GuruSDKUtils.MergeDictionary(dict, extra); | ||||
|             LogEvent(Consts.EventNotiPermRationaleImp, dict); | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 说明性通知栏权限引导结果时触发 (noti_perm_rationale_result) | ||||
|         /// </summary> | ||||
|         /// <param name="result"></param> | ||||
|         /// <param name="pageName"></param> | ||||
|         /// <param name="scene"></param> | ||||
|         /// <param name="extra"></param> | ||||
|         public static void LogNotiPermRationaleResult(string result, string pageName, string scene = "", Dictionary<string, object> extra = null) | ||||
|         { | ||||
|             var dict = new Dictionary<string, object>() | ||||
|             { | ||||
|                 ["result"] = result, | ||||
|                 [Consts.ParameterItemCategory] = pageName, | ||||
|             }; | ||||
| 
 | ||||
|             if (!string.IsNullOrEmpty(scene)) | ||||
|                 dict[Consts.ParameterItemName] = scene; | ||||
| 
 | ||||
|             if (extra != null) dict = GuruSDKUtils.MergeDictionary(dict, extra); | ||||
|             LogEvent(Consts.EventNotiPermRationaleResult, dict); | ||||
|         } | ||||
| 
 | ||||
|         #endregion | ||||
| 
 | ||||
|         #region 错误时间上报 | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 上报错误事件 | ||||
|         /// </summary> | ||||
|         /// <param name="errorCode"></param> | ||||
|         /// <param name="err"></param> | ||||
|         /// <param name="country"></param> | ||||
|         /// <param name="network"></param> | ||||
|         public static void LogDevAudit(string errorCode, string err, string country = "", string network = "") | ||||
|         { | ||||
|             var dict = new Dictionary<string, object>() | ||||
|             { | ||||
|                 [Consts.ParameterItemCategory] = "error_event", | ||||
|                 [Consts.ParameterItemName] = errorCode, | ||||
|                 ["err"] = err, | ||||
|                 ["country"] = country, | ||||
|                 ["network"] = network, | ||||
|             }; | ||||
|             LogEvent(Consts.EventDevAudit, dict); | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -36,9 +36,26 @@ namespace Guru | |||
| 			public const string EventShare = "share"; | ||||
| 			public const string EventSignUp = "sign_up"; | ||||
| 			public const string EventSpendVirtualCurrency = "spend_virtual_currency"; | ||||
| 			public const string EventTutorialBegin = "tutorial_begin"; | ||||
| 			public const string EventTutorialComplete = "tutorial_complete"; | ||||
| 			public const string EventUnlockAchievement = "unlock_achievement"; | ||||
| 			public const string EventHpPoints = "hp_points"; | ||||
| 			 | ||||
| 			public const string EventAttReguideImp = "att_reguide_imp"; | ||||
| 			public const string EventAttReguideClk = "att_reguide_clk"; | ||||
| 			public const string EventAttReguideResult = "att_reguide_result"; | ||||
| 			 | ||||
| 			public const string EventTutorialBegin = "tutorial_begin"; | ||||
| 			public const string EventTutorialImp= "tutorial_{0}_imp"; | ||||
| 			public const string EventTutorialNextClick= "tutorial_{0}_next_clk"; | ||||
| 			public const string EventTutorialComplete= "tutorial_complete"; | ||||
| 			public const string EventTutorialClose = "tutorial_close"; | ||||
| 			 | ||||
| 			public const string EventNotiPermImp = "noti_perm_imp"; | ||||
| 			public const string EventNotiPermResult = "noti_perm_result"; | ||||
| 			public const string EventNotiPermRationaleImp = "noti_perm_rationale_imp"; | ||||
| 			public const string EventNotiPermRationaleResult = "noti_perm_rationale_result"; | ||||
| 			 | ||||
| 			public const string EventDevAudit = "dev_audit"; | ||||
| 			 | ||||
| 			public const string EventViewCart = "view_cart"; | ||||
| 			public const string EventViewItem = "view_item"; | ||||
| 			public const string EventViewItemList = "view_item_list"; | ||||
|  | @ -228,6 +245,7 @@ namespace Guru | |||
| 			public const string CurrencyCategoryIGC = "igc"; // In game currency | ||||
| 			public const string CurrencyCategoryIGB = "igb"; // In game barter | ||||
| 			public const string CurrencyCategoryProp = "prop"; // prop | ||||
| 			public const string CurrencyCategoryProps = "props"; // props | ||||
| 			public const string CurrencyCategoryBundle = "bundle"; // prop groups | ||||
| 			 | ||||
| 			 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue