update: 补全默认的用户属性打点 添加 network 属性

dev
胡宇飞 2024-07-26 14:38:55 +08:00
parent 1e59e5efa6
commit 4246251295
3 changed files with 27 additions and 3 deletions

View File

@ -509,6 +509,11 @@ namespace Guru
SetUserProperty(Consts.PropertyAdjustId, adjustId); SetUserProperty(Consts.PropertyAdjustId, adjustId);
} }
public static void SetNetworkStatus()
{
SetUserProperty(Consts.PropertyNetwork, Instance.GetNetworkStatus());
}
/// <summary> /// <summary>
/// 初始化时调用一下所有的属性打点 </br> /// 初始化时调用一下所有的属性打点 </br>
/// <a href="https://docs.google.com/spreadsheets/d/1N47rXgjatRHFvzWWx0Hqv5C1D9NHHGbggi6pQ65c-zQ/edit#gid=1858695240">用户属性文档</a> /// <a href="https://docs.google.com/spreadsheets/d/1N47rXgjatRHFvzWWx0Hqv5C1D9NHHGbggi6pQ65c-zQ/edit#gid=1858695240">用户属性文档</a>
@ -559,6 +564,8 @@ namespace Guru
if(!HasUserPropertyKey(Consts.PropertyNotiPerm)) if(!HasUserPropertyKey(Consts.PropertyNotiPerm))
SetNotiPerm("not_determined"); // noti_perm SetNotiPerm("not_determined"); // noti_perm
if(!HasUserPropertyKey(Consts.PropertyNetwork))
SetNetworkStatus(); // NetworkStatus
} }
@ -577,7 +584,8 @@ namespace Guru
{ {
{ "boost_time", time.ToString("F6") }, { "boost_time", time.ToString("F6") },
{ Consts.PropertyDeviceID, DeviceId }, { Consts.PropertyDeviceID, DeviceId },
{ "version", Version} { "version", Version},
{ "network", Instance.GetNetworkStatus()},
}, new Analytics.EventSetting() }, new Analytics.EventSetting()
{ {
EnableFirebaseAnalytics = true, EnableFirebaseAnalytics = true,

View File

@ -235,6 +235,7 @@ namespace Guru
public const string PropertyCoin = "coin"; //当前金币数 public const string PropertyCoin = "coin"; //当前金币数
public const string PropertyExp = "exp"; // 经验值 public const string PropertyExp = "exp"; // 经验值
public const string PropertyHp = "hp"; // 生命值/体力 public const string PropertyHp = "hp"; // 生命值/体力
public const string PropertyNetwork = "network"; // 网络状态
public const string PropertyAndroidID = "android_id"; // Android 平台 AndroidID public const string PropertyAndroidID = "android_id"; // Android 平台 AndroidID
public const string PropertyIDFV = "idfv"; // iOS 平台 IDFV public const string PropertyIDFV = "idfv"; // iOS 平台 IDFV
public const string PropertyPicture = "picture"; // 玩家在主线的mapid public const string PropertyPicture = "picture"; // 玩家在主线的mapid

View File

@ -794,6 +794,7 @@ namespace Guru
private NetworkStatusMonitor _networkStatusMonitor; private NetworkStatusMonitor _networkStatusMonitor;
private string _networkStatus;
private void InitNetworkMonitor() private void InitNetworkMonitor()
{ {
@ -806,8 +807,8 @@ namespace Guru
if (success) if (success)
{ {
// 上报用户network属性 // 上报用户network属性
var status = _networkStatusMonitor.GetNetworkStatus(); _networkStatus = _networkStatusMonitor.GetNetworkStatus();
SetUserProperty("network", status); SetUserProperty(Consts.PropertyNetwork, _networkStatus);
} }
else else
{ {
@ -816,6 +817,20 @@ namespace Guru
} }
private string GetNetworkStatus()
{
if(_networkStatusMonitor != null)
{
_networkStatus = _networkStatusMonitor.GetNetworkStatus();
}
else
{
_networkStatus = "none";
}
return _networkStatus;
}
#endregion #endregion
} }
} }