update: 完善刷新用户属性逻辑

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

View File

@ -352,42 +352,46 @@ namespace Guru
} }
/// <summary> /// <summary>
/// 初始化时调用一下所有的属性打点 /// 初始化时调用一下所有的属性打点 </br>
/// <a href="https://docs.google.com/spreadsheets/d/1N47rXgjatRHFvzWWx0Hqv5C1D9NHHGbggi6pQ65c-zQ/edit#gid=1858695240">用户属性文档</a>
/// </summary> /// </summary>
private static void InitCallAllUserProperties() private static void UpdateAllUserProperties()
{ {
if(!HasUserPropertyKey(Consts.PropertyFirstOpenTime)) if(!HasUserPropertyKey(Consts.PropertyFirstOpenTime))
SetFirstOpenTime(TimeUtil.GetCurrentTimeStamp().ToString()); SetFirstOpenTime(TimeUtil.GetCurrentTimeStamp().ToString()); // first_open_time
if(!HasUserPropertyKey(Consts.PropertyIsIAPUser)) if(!HasUserPropertyKey(Consts.PropertyIsIAPUser))
SetUserIsIAP(Model?.IsIapUser ?? false); SetUserIsIAP(Model?.IsIapUser ?? false); // is_iap_user
if (!HasUserPropertyKey(Consts.PropertyLevel)) if (!HasUserPropertyKey(Consts.PropertyLevel))
SetUserBLevel(Model?.SuccessLevelId ?? 0); SetUserBLevel(Model?.SuccessLevelId ?? 0); // b_level
if(!HasUserPropertyKey(Consts.PropertyUserID) && !string.IsNullOrEmpty(UID)) if (!HasUserPropertyKey(Consts.PropertyPlay))
SetUserProperty(Consts.PropertyUserID, UID); SetUserBLevel(Model?.TotalPlayedCount ?? 0); // b_play
if(!HasUserPropertyKey(Consts.PropertyDeviceID) && !string.IsNullOrEmpty(DeviceId)) if(!HasUserPropertyKey(Consts.PropertyUserID))
SetUserProperty(Consts.PropertyDeviceID, DeviceId); SetUserProperty(Consts.PropertyUserID, UID); // user_id
if(!HasUserPropertyKey(Consts.PropertyDeviceID))
SetUserProperty(Consts.PropertyDeviceID, DeviceId); // device_id
if(!HasUserPropertyKey(Consts.PropertyIAPCoin)) if(!HasUserPropertyKey(Consts.PropertyIAPCoin))
SetUserPaidCoins(0); SetUserPaidCoins(0); // iap_coin
if(!HasUserPropertyKey(Consts.PropertyNonIAPCoin)) if(!HasUserPropertyKey(Consts.PropertyNonIAPCoin))
SetUserFreeCoins(0); SetUserFreeCoins(0); // non_iap_coin
if(!HasUserPropertyKey(Consts.PropertyCoin)) if(!HasUserPropertyKey(Consts.PropertyCoin))
SetUserTotalCoins(0); SetUserTotalCoins(0);// coin
if (!HasUserPropertyKey(Consts.PropertyGrade)) if (!HasUserPropertyKey(Consts.PropertyGrade))
SetUserGrade(0); SetUserGrade(0); // grade
if(!HasUserPropertyKey(Consts.PropertyExp)) if(!HasUserPropertyKey(Consts.PropertyExp))
SetUserExp(0); SetUserExp(0); // exp
if(!HasUserPropertyKey(Consts.PropertyHp)) if(!HasUserPropertyKey(Consts.PropertyHp))
SetUserHp(0); SetUserHp(0); // hp
#if UNITY_IOS #if UNITY_IOS
if(!HasUserPropertyKey(Consts.PropertyATTStatus)) if(!HasUserPropertyKey(Consts.PropertyATTStatus))
@ -397,7 +401,6 @@ namespace Guru
if(!HasUserPropertyKey(Consts.PropertyNotiPerm)) if(!HasUserPropertyKey(Consts.PropertyNotiPerm))
SetUserProperty(Consts.PropertyNotiPerm, "not_determined"); SetUserProperty(Consts.PropertyNotiPerm, "not_determined");
} }

View File

@ -192,6 +192,8 @@ namespace Guru
GuruIAP.Instance.SetUID(UID); GuruIAP.Instance.SetUID(UID);
GuruIAP.Instance.SetUUID(UUID); GuruIAP.Instance.SetUUID(UUID);
} }
UpdateAllUserProperties(); // 同步所有用户属性打点
} }
} }
@ -225,9 +227,10 @@ namespace Guru
LogSDKInitTime(sp.TotalSeconds); LogSDKInitTime(sp.TotalSeconds);
// 上报所有初始化用户属性 // 上报所有初始化用户属性
InitCallAllUserProperties(); UpdateAllUserProperties();
} }
/// <summary> /// <summary>
/// 注入云控参数基础数据 /// 注入云控参数基础数据
/// </summary> /// </summary>