update: 自打点添加防空判定

deeplink
胡宇飞 2024-03-19 11:37:22 +08:00
parent 7bf90ae804
commit 67d0896424
2 changed files with 48 additions and 7 deletions

View File

@ -78,13 +78,47 @@ namespace Guru
string bundleId = Application.identifier; string bundleId = Application.identifier;
CallStatic("init", appId, deviceInfo, bundleId, UseWorker, isDebug); // 调用接口 CallStatic("init", appId, deviceInfo, bundleId, UseWorker, isDebug); // 调用接口
} }
public void SetScreen(string screenName) => CallStatic("setScreen", screenName); public void SetScreen(string screenName)
public void SetAdId(string id) => CallStatic("setAdId", id); {
public void SetUserProperty(string key, string value) => CallStatic("setUserProperty", key, value); if (string.IsNullOrEmpty(screenName)) return;
public void SetFirebaseId(string id) => CallStatic("setFirebaseId", id); CallStatic("setScreen", screenName);
public void SetAdjustId(string id) => CallStatic("setAdjustId", id); }
public void SetDeviceId(string deviceId) => CallStatic("setDeviceId", deviceId); public void SetAdId(string id)
public void SetUid(string uid) => CallStatic("setUid", uid); {
if (string.IsNullOrEmpty(id)) return;
CallStatic("setAdId", id);
}
public void SetUserProperty(string key, string value)
{
if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(value)) return;
CallStatic("setUserProperty", key, value);
}
public void SetFirebaseId(string id)
{
if (string.IsNullOrEmpty(id)) return;
CallStatic("setFirebaseId", id);
}
public void SetAdjustId(string id)
{
if (string.IsNullOrEmpty(id)) return;
CallStatic("setAdjustId", id);
}
public void SetDeviceId(string deviceId)
{
if (string.IsNullOrEmpty(deviceId)) return;
CallStatic("setDeviceId", deviceId);
}
public void SetUid(string uid)
{
if (string.IsNullOrEmpty(uid)) return;
CallStatic("setUid", uid);
}
public bool IsDebug => CallStatic<bool>("isDebug"); public bool IsDebug => CallStatic<bool>("isDebug");
public void LogEvent(string eventName, string parameters) => CallStatic("logEvent", eventName, parameters); public void LogEvent(string eventName, string parameters) => CallStatic("logEvent", eventName, parameters);
public void ReportEventSuccessRate() => CallStatic("reportEventRate"); public void ReportEventSuccessRate() => CallStatic("reportEventRate");

View File

@ -43,6 +43,7 @@ namespace Guru
public void SetScreen(string screenName) public void SetScreen(string screenName)
{ {
if (string.IsNullOrEmpty(screenName)) return;
#if UNITY_IOS #if UNITY_IOS
unitySetScreen(screenName); unitySetScreen(screenName);
#endif #endif
@ -50,6 +51,7 @@ namespace Guru
public void SetAdId(string id) public void SetAdId(string id)
{ {
if (string.IsNullOrEmpty(id)) return;
#if UNITY_IOS #if UNITY_IOS
unitySetAdId(id); unitySetAdId(id);
#endif #endif
@ -57,6 +59,7 @@ namespace Guru
public void SetUserProperty(string key, string value) public void SetUserProperty(string key, string value)
{ {
if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(value)) return;
#if UNITY_IOS #if UNITY_IOS
unitySetUserProperty(key, value); unitySetUserProperty(key, value);
#endif #endif
@ -64,6 +67,7 @@ namespace Guru
public void SetFirebaseId(string fid) public void SetFirebaseId(string fid)
{ {
if (string.IsNullOrEmpty(fid)) return;
#if UNITY_IOS #if UNITY_IOS
unitySetFirebaseId(fid); unitySetFirebaseId(fid);
#endif #endif
@ -71,6 +75,7 @@ namespace Guru
public void SetAdjustId(string id) public void SetAdjustId(string id)
{ {
if (string.IsNullOrEmpty(id)) return;
#if UNITY_IOS #if UNITY_IOS
unitySetAdjustID(id); unitySetAdjustID(id);
#endif #endif
@ -78,6 +83,7 @@ namespace Guru
public void SetDeviceId(string deviceId) public void SetDeviceId(string deviceId)
{ {
if (string.IsNullOrEmpty(deviceId)) return;
#if UNITY_IOS #if UNITY_IOS
unitySetDeviceId(deviceId); unitySetDeviceId(deviceId);
#endif #endif
@ -85,6 +91,7 @@ namespace Guru
public void SetUid(string uid) public void SetUid(string uid)
{ {
if (string.IsNullOrEmpty(uid)) return;
#if UNITY_IOS #if UNITY_IOS
unitySetUserID(uid); unitySetUserID(uid);
#endif #endif