update: 升级 GuruAnalytic 至 1.12.0, 新增 priority 参数, Android 端升级至 1.1.1

--story=1020598 --user=yufei.hu 【中台】【BI】升级自打点插件至 1.12.0, Native 接口添加 priority 参数和功能 https://www.tapd.cn/33527076/s/1151108

Signed-off-by: huyufei <yufei.hu@castbox.fm>
main
胡宇飞 2024-06-18 09:47:23 +08:00
parent 4a5229780a
commit f360529552
16 changed files with 81 additions and 29 deletions

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 07cf2335bd298401b8015718fca55265
guid: 32eda01e213614348899eefe856392d3
PluginImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: caf6ff09835a4a75bff1b4b068f664ef
timeCreated: 1717117895

View File

@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 66c5f430ab9654ef4a2376e71aa04bca
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@ -16,6 +16,15 @@ GuruAnalyticsLib 的 Unity 插件库
## Change Logs
### 1.12.0
- Android 端对齐 `1.1.1`
> Hash: 91ace53e86a17fb0d234a27f1c78b54bfa3bc6ea
- iOS 端对齐 `0.3.6`
> Hash: 0cd5ce7aa64e12caa7413c938a3164687b973843
- Pod 库改为 本地文件引用 (配合外部发行项目)
### 1.11.0
- Android 端对齐 `1.0.3`
> Hash: 1978686dbcba38b7b0421d8b6b2bef111356366b

View File

@ -14,7 +14,7 @@ namespace Guru
public class GuruAnalytics
{
// Plugin Version
public const string Version = "1.11.0";
public const string Version = "1.10.5";
public static readonly string Tag = "[ANU]";
private static readonly string ActionName = "logger_error";
@ -200,7 +200,8 @@ namespace Guru
/// </summary>
/// <param name="eventName">事件名称</param>
/// <param name="data">INT类型的值</param>
public static void LogEvent(string eventName, Dictionary<string, dynamic> data = null)
/// <param name="priority"></param>
public static void LogEvent(string eventName, Dictionary<string, dynamic> data = null, int priority = -1)
{
if(_autoSyncProperties)
UpdateAllUserProperties(); // 每次打点更新用户属性
@ -211,7 +212,7 @@ namespace Guru
raw = BuildParamsJson(data);
}
Debug.Log($"{Tag} event:{eventName} | raw: {raw}");
Agent?.LogEvent(eventName, raw);
Agent?.LogEvent(eventName, raw, priority);
}
private static string BuildParamsString(Dictionary<string, dynamic> data)

View File

@ -15,7 +15,7 @@ namespace Guru
void SetUid(string uid);
bool IsDebug { get; }
bool EnableErrorLog { get; set; }
void LogEvent(string eventName, string parameters);
void LogEvent(string eventName, string parameters, int priority = -1);
void ReportEventSuccessRate(); // 上报任务成功率
void SetTch02Value(double value); // 设置太极02数值
void InitCallback(string objName, string method); // 设置回调对象参数

View File

@ -124,7 +124,11 @@ namespace Guru
}
public bool IsDebug => CallStatic<bool>("isDebug");
public void LogEvent(string eventName, string parameters) => CallStatic("logEvent", eventName, parameters);
public void LogEvent(string eventName, string parameters, int priority = -1)
{
if (priority < 0) priority = Analytics.EventPriorityDefault;
CallStatic("logEvent", eventName, parameters, priority);
}
public void ReportEventSuccessRate() => CallStatic("reportEventRate");
public void SetTch02Value(double value) => CallStatic("setTch02Value", value);
public void InitCallback(string objName, string method) => CallStatic("initCallback", objName, method);

View File

@ -122,8 +122,9 @@ namespace Guru
public bool IsDebug => _isDebug;
public void LogEvent(string eventName, string data)
public void LogEvent(string eventName, string data, int priority = -1)
{
if (priority < 0) priority = Analytics.EventPriorityDefault;
#if UNITY_IOS
unityLogEvent(eventName, data);
#endif

View File

@ -87,7 +87,7 @@ namespace Guru
public bool IsDebug => _isDebug;
public void LogEvent(string eventName, string parameters)
public void LogEvent(string eventName, string parameters, int priority = -1)
{
if (_isShowLog)
{
@ -127,7 +127,7 @@ namespace Guru
}
}
Debug.Log($"{TAG} LogEvent: event:<color=orange>{eventName}</color> Properties:\n{sb.ToString()}");
Debug.Log($"{TAG} LogEvent: event:<color=orange>{eventName} ({priority})</color> Properties:\n{sb.ToString()}");
}
}
}

View File

@ -15,7 +15,9 @@ namespace Guru
// 美元符号
public static readonly string USD = "USD";
// 广告平台
public static readonly string AdMAX = "MAX";
public static readonly string AdMAX = "MAX";
// 默认自打点优先级
public static readonly int EventPriorityDefault = 10;
//IAP打点事件
public static readonly string EventIAPFirst = "first_iap";

View File

@ -309,12 +309,12 @@ namespace Guru
/// </summary>
/// <param name="key"></param>
/// <param name="data"></param>
private static void CustomLogEvent(string key, Dictionary<string, dynamic> data = null)
private static void CustomLogEvent(string key, Dictionary<string, dynamic> data = null, int priority = -1)
{
try
{
if (data == null) data = new Dictionary<string, dynamic>();
GuruAnalytics.LogEvent(key, data);
GuruAnalytics.LogEvent(key, data, priority);
UpdateAllValues(); // 同步所有的ID
}
catch (Exception e)

View File

@ -1,10 +1,8 @@
using System.Collections;
namespace Guru
{
using System;
using System.Collections;
using System.Collections.Generic;
using com.adjust.sdk;
using Facebook.Unity;
@ -148,10 +146,10 @@ namespace Guru
/// </summary>
/// <param name="eventName"></param>
/// <param name="eventSetting"></param>
internal static void LogEvent(string eventName, EventSetting eventSetting = null)
internal static void LogEvent(string eventName, EventSetting eventSetting = null, int priority = -1)
{
Log.I(TAG, $"eventName:{eventName}");
CustomLogEvent(eventName); // 自定义打点上报
CustomLogEvent(eventName, null, priority); // 自定义打点上报
CheckLogCache(eventName, null, eventSetting); // log缓存和消费
if (!IsEnable) return;
@ -180,18 +178,17 @@ namespace Guru
/// <param name="eventName"></param>
/// <param name="extras"></param>
/// <param name="eventSetting"></param>
internal static void LogEvent(string eventName, Dictionary<string, dynamic> extras, EventSetting eventSetting = null)
internal static void LogEvent(string eventName, Dictionary<string, dynamic> extras, EventSetting eventSetting = null, int priority = -1)
{
Log.I(TAG, $"eventName:{eventName}, params:{string.Join(",", extras)}");
CustomLogEvent(eventName, extras); // 自定义打点上报
CustomLogEvent(eventName, extras, priority); // 自定义打点上报
CheckLogCache(eventName, extras, eventSetting); // log缓存和消费
if (!IsEnable) return;
if (extras == null)
{
LogEvent(eventName, eventSetting); // 防空判定
LogEvent(eventName, eventSetting, priority); // 防空判定
return;
}
@ -312,7 +309,7 @@ namespace Guru
}
private static void CheckLogCache(string key, Dictionary<string, dynamic> data = null, EventSetting setting = null)
private static void CheckLogCache(string key, Dictionary<string, dynamic> data = null, EventSetting setting = null, int priority = -1)
{
try
{
@ -320,7 +317,7 @@ namespace Guru
{
if (data == null) data = new Dictionary<string, dynamic>();
data["log_stamp"] = TimeUtil.GetCurrentTimeStamp().ToString();
SavedLogs.Enqueue(new SavedLog(key, data, setting));
SavedLogs.Enqueue(new SavedLog(key, data, setting, priority));
}
else
{
@ -330,7 +327,7 @@ namespace Guru
while (SavedLogs.Count > 0)
{
var log = SavedLogs.Dequeue();
LogEvent(log.key, log.data, log.setting);
LogEvent(log.key, log.data, log.setting, log.priority);
}
}
}
@ -349,18 +346,27 @@ namespace Guru
internal class SavedLog
{
public string key;
public int priority;
public Dictionary<string, dynamic> data;
public Analytics.EventSetting setting;
public SavedLog()
{
}
public SavedLog(string _key, Dictionary<string, dynamic> _data = null, Analytics.EventSetting _setting = null)
/// <summary>
/// 保存打点信息
/// </summary>
/// <param name="_key"></param>
/// <param name="_data"></param>
/// <param name="_setting"></param>
/// <param name="_priority"></param>
public SavedLog(string _key, Dictionary<string, dynamic> _data = null, Analytics.EventSetting _setting = null, int _priority = -1)
{
key = _key;
data = _data;
setting = _setting;
priority = _priority;
}
}
}