update: 更新打点参数和打点库逻辑

--story=1020273 --user=yufei.hu 【中台】【BI】 中台打点标准化, 更新原有的打点和用户属性上报逻辑 https://www.tapd.cn/33527076/s/1147487
hotfix/v1.0.12.2
胡宇飞 2024-05-29 21:00:43 +08:00
parent bc62aec38e
commit 0c4d6b31e9
1 changed files with 34 additions and 23 deletions

View File

@ -123,7 +123,7 @@ namespace Guru
/// <param name="extra">扩展数据</param>
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<string, object> extra = null )
int duration = 0, int? step = null, int? score = null, Dictionary<string, object> extra = null )
{
if (!IsInitialSuccess)
{
@ -171,7 +171,7 @@ namespace Guru
/// </summary>
public static void LogLevelFail(int levelId,
string levelType = LevelTypeMain, string levelName = "", string puzzleId = "",
int? duration = null, int? step = null, int? score = null , Dictionary<string, object> extra = null)
int duration = 0, int? step = null, int? score = null , Dictionary<string, object> extra = null)
{
LogLevelEnd(levelId, EventLevelEndFail, levelType, levelName, puzzleId, duration, step, score, extra);
}
@ -181,7 +181,7 @@ namespace Guru
/// </summary>
public static void LogLevelFailExit(int levelId,
string levelType = LevelTypeMain, string levelName = "", string puzzleId = "",
int? duration = null, int? step = null, int? score = null, Dictionary<string, object> extra = null)
int duration = 0, int? step = null, int? score = null, Dictionary<string, object> extra = null)
{
LogLevelEnd(levelId, EventLevelEndExit, levelType, levelName, puzzleId, duration, step, score, extra);
}
@ -191,7 +191,7 @@ namespace Guru
/// </summary>
public static void LogLevelFailTimeout(int levelId,
string levelType = LevelTypeMain, string levelName = "", string puzzleId = "",
int? duration = null, int? step = null, int? score = null, Dictionary<string, object> extra = null)
int duration = 0, int? step = null, int? score = null, Dictionary<string, object> 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}");
}
/// <summary>
@ -305,7 +305,7 @@ namespace Guru
/// <param name="totalCoins"></param>
public static void SetUserTotalCoins(int totalCoins)
{
SetUserProperty(Analytics.PropertyCoin, $"{totalCoins}");
SetUserProperty(Consts.PropertyCoin, $"{totalCoins}");
}
/// <summary>
@ -314,7 +314,7 @@ namespace Guru
/// <param name="freeCoins"></param>
public static void SetUserFreeCoins(int freeCoins)
{
SetUserProperty(Analytics.PropertyNonIAPCoin, $"{freeCoins}");
SetUserProperty(Consts.PropertyNonIAPCoin, $"{freeCoins}");
}
/// <summary>
@ -323,33 +323,44 @@ namespace Guru
/// <param name="freeCoins"></param>
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);
}
/// <summary>
/// 初始化时调用一下所有的属性打点 </br>
@ -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
/// <summary>
/// 当付费页面打开时调用
/// 当付费页面打开时调用 iap_imp
/// </summary>
/// <param name="scene">付费页面名称, 默认为 Store</param>
/// <param name="scene">付费页场景名称</param>
/// <param name="productId">列表中首个商品的 ProductId </param>
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
}
/// <summary>
/// 当付费页面关闭时调用
/// 当付费页面关闭时调用 iap_close
/// </summary>
/// <param name="scene"></param>
/// <param name="productId"></param>
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
}
/// <summary>
/// 当点击 IAP 商品按钮的时候调用
/// 当点击 IAP 商品按钮的时候调用 iap_clk
/// </summary>
/// <param name="scene"></param>
/// <param name="productId"></param>
@ -852,7 +863,7 @@ namespace Guru
#endregion
#region Crashlytics 接口
public static void CrashLog(string message)