Merge tag '1.0.13' into dev

Signed-off-by: huyufei <yufei.hu@castbox.fm>

# Conflicts:
#	Runtime/GuruCore/Runtime/Analytics/Analytics.TemplateDefine.cs
main
胡宇飞 2024-06-19 19:31:28 +08:00
commit 9024b8171c
17 changed files with 96 additions and 38 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

@ -12,10 +12,24 @@ GuruAnalyticsLib 的 Unity 插件库
- (1) 请将 repo 内的两个文件夹 `Assets``Classses` 拷贝至 `./Runtime/GuruAnalytics/Plugins/iOS/GuruAnalytics` 目录下:
- (2) 请将部署到 Unity 内所有的 `.swift` 文件的 meta 属性内, 取消 iOS 文件属性. (因为打包时会按照 POD 导入)
- 注意及时更新 `GuruAnalyticsLib.podspec`文件内的更新内容
```ruby
# 将 source 内的 git 属性删除, 只保留 tag 属性
# s.source = { :git => 'git@github.com:castbox/GuruAnalytics_iOS.git', :tag => s.version.to_s }
s.source = { :tag => s.version.to_s }
```
---
## Change Logs
### 1.12.0
- Android 端对齐 `1.1.1`
> Hash: bdb41ae118dcf438e8efe4f27d0ec856bc3147b0
- iOS 端对齐 `0.3.6`
> Hash: 0cd5ce7aa64e12caa7413c938a3164687b973843
- Pod 库改为 本地文件引用 (配合外部发行项目)
### 1.11.0
- Android 端对齐 `1.0.3`
> Hash: 1978686dbcba38b7b0421d8b6b2bef111356366b

View File

@ -14,10 +14,11 @@ 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";
internal const int EventPriorityDefault = 10;
private static IAnalyticsAgent _agent;
@ -200,7 +201,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(); // 每次打点更新用户属性
@ -210,8 +212,9 @@ namespace Guru
{
raw = BuildParamsJson(data);
}
Debug.Log($"{Tag} event:{eventName} | raw: {raw}");
Agent?.LogEvent(eventName, raw);
if (priority < 0) priority = EventPriorityDefault;
Debug.Log($"{Tag} event:{eventName} | raw: {raw} | priority: {priority}");
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,10 @@ 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)
{
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,7 +122,7 @@ namespace Guru
public bool IsDebug => _isDebug;
public void LogEvent(string eventName, string data)
public void LogEvent(string eventName, string data, int priority = -1)
{
#if UNITY_IOS
unityLogEvent(eventName, data);

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

@ -29,7 +29,7 @@ namespace Guru
{
return null;
}
UnityEngine.Debug.Log($"{TAG} --- Send Adjust Event: {eventName}({tokenID})");
return new AdjustEvent(tokenID);
}

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,10 @@
using System.Collections;
using UnityEngine;
namespace Guru
{
using System;
using System.Collections;
using System.Collections.Generic;
using com.adjust.sdk;
using Facebook.Unity;
@ -148,10 +148,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 +180,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;
}
@ -258,15 +257,16 @@ namespace Guru
/// <param name="key"></param>
/// <param name="data"></param>
/// <param name="setting"></param>
public static void Track(string key, Dictionary<string, dynamic> data = null, EventSetting setting = null)
/// <param name="priority"></param>
public static void Track(string key, Dictionary<string, dynamic> data = null, EventSetting setting = null, int priority = -1)
{
if (null != data)
{
LogEvent(key, data, setting);
LogEvent(key, data, setting, priority);
}
else
{
LogEvent(key, setting);
LogEvent(key, setting, priority);
}
}
@ -312,7 +312,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 +320,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 +330,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,6 +349,7 @@ namespace Guru
internal class SavedLog
{
public string key;
public int priority;
public Dictionary<string, dynamic> data;
public Analytics.EventSetting setting;
@ -356,11 +357,19 @@ namespace Guru
{
}
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;
}
}
}