临时保存
This commit is contained in:
parent
937749168d
commit
8b7054ef00
|
|
@ -3,6 +3,7 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using EFSDK;
|
using EFSDK;
|
||||||
using Firebase.RemoteConfig;
|
using Firebase.RemoteConfig;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Script.Common;
|
using Script.Common;
|
||||||
using Script.SDKManager.AdsSDKManager.Constant;
|
using Script.SDKManager.AdsSDKManager.Constant;
|
||||||
using Script.Utils;
|
using Script.Utils;
|
||||||
|
|
@ -35,6 +36,8 @@ public class AppSDKManager : MonoBehaviour
|
||||||
StartCoroutine(coroutine);
|
StartCoroutine(coroutine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region ad
|
||||||
|
|
||||||
public void ShowInterstitial(string position, IvType ivadType = IvType.IV1, Action<double> callback = null)
|
public void ShowInterstitial(string position, IvType ivadType = IvType.IV1, Action<double> callback = null)
|
||||||
{
|
{
|
||||||
//插屏展示逻辑
|
//插屏展示逻辑
|
||||||
|
|
@ -60,6 +63,56 @@ public class AppSDKManager : MonoBehaviour
|
||||||
return AdsSDKManager.Instance.IsRewardAdReady();;
|
return AdsSDKManager.Instance.IsRewardAdReady();;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 埋点
|
||||||
|
|
||||||
|
public void LogEvent(string eventName)
|
||||||
|
{
|
||||||
|
// ShuShuEvent.Instance.Track(eventName);
|
||||||
|
// FireBaseAnalyticsManager.Instance.LogEvent(eventName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogEvent(string eventName, string key1, object value1)
|
||||||
|
{
|
||||||
|
// ShuShuEvent.Instance.Track(eventName, key1, value1);
|
||||||
|
// FireBaseAnalyticsManager.Instance.LogEvent(eventName, key1, value1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogEvent(string eventName, string key1, object value1, string key2, object value2)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogEvent(string eventName, Dictionary<string, object> extraInfo)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 公共事件属性
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
public void SetSuperProperties(Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
ShuShuEvent.Instance.SetSuperProperties(args);
|
||||||
|
FireBaseAnalyticsManager.Instance.SetSuperProperties(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户属性
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
public void SetUserProperties(Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
ShuShuEvent.Instance.UserSet(args);
|
||||||
|
FireBaseAnalyticsManager.Instance.SetUserProperty(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void ShowRewardAd(string position, Action<double> callback = null)
|
public void ShowRewardAd(string position, Action<double> callback = null)
|
||||||
{
|
{
|
||||||
bool isRewardAdReady = AdsSDKManager.Instance.IsRewardAdReady();
|
bool isRewardAdReady = AdsSDKManager.Instance.IsRewardAdReady();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Firebase.Analytics;
|
using Firebase.Analytics;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
@ -12,34 +13,33 @@ using Script.Utils;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class FireBaseAnalyticsManager : NormalSingleton<FireBaseAnalyticsManager>
|
public class FireBaseAnalyticsManager : NormalSingleton<FireBaseAnalyticsManager>
|
||||||
{
|
{
|
||||||
|
private const string KEY_SUPER_PROPERTIES = "KEY_SUPER_PROPERTIES";
|
||||||
|
|
||||||
|
private Dictionary<string, object> superProperties = new Dictionary<string, object>();
|
||||||
|
|
||||||
|
public void InitSuperProperties()
|
||||||
|
{
|
||||||
|
string json = PlayerPrefsUtils.GetPlayerPrefsString(KEY_SUPER_PROPERTIES, "");
|
||||||
|
if (!string.IsNullOrEmpty(json))
|
||||||
|
{
|
||||||
|
superProperties = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void LogEvent(string eventName)
|
public void LogEvent(string eventName)
|
||||||
{
|
{
|
||||||
Firebase.Analytics.FirebaseAnalytics.LogEvent(eventName);
|
List<Parameter> parameterList = new List<Parameter>();
|
||||||
}
|
if (superProperties != null)
|
||||||
|
{
|
||||||
|
foreach (var superProperty in superProperties)
|
||||||
|
{
|
||||||
|
Parameter parameter = new Parameter(superProperty.Key, superProperty.Value.ToString());
|
||||||
|
parameterList.Add(parameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void LogEvent(string eventName, string key1, string value1)
|
FirebaseAnalytics.LogEvent(eventName, parameterList.ToArray());
|
||||||
{
|
|
||||||
Firebase.Analytics.FirebaseAnalytics.LogEvent(eventName, key1, value1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LogEvent(string eventName, string key1, double value1)
|
|
||||||
{
|
|
||||||
Firebase.Analytics.FirebaseAnalytics.LogEvent(eventName, key1, value1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LogEvent(string eventName, string key1, long value1)
|
|
||||||
{
|
|
||||||
Firebase.Analytics.FirebaseAnalytics.LogEvent(eventName, key1, value1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LogEvent(string eventName, string key1, int value1)
|
|
||||||
{
|
|
||||||
Firebase.Analytics.FirebaseAnalytics.LogEvent(eventName, key1, value1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LogEvent(string eventName, Parameter[] parameters)
|
|
||||||
{
|
|
||||||
Firebase.Analytics.FirebaseAnalytics.LogEvent(eventName, parameters);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LogEvent(string eventName, Dictionary<string, string> dict)
|
public void LogEvent(string eventName, Dictionary<string, string> dict)
|
||||||
|
|
@ -63,6 +63,40 @@ public class FireBaseAnalyticsManager : NormalSingleton<FireBaseAnalyticsManager
|
||||||
Firebase.Analytics.FirebaseAnalytics.SetUserProperty(name, property);
|
Firebase.Analytics.FirebaseAnalytics.SetUserProperty(name, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置用户属性
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <param name="property"></param>
|
||||||
|
public void SetUserProperty(Dictionary<string, object> propertys)
|
||||||
|
{
|
||||||
|
foreach (var property in propertys)
|
||||||
|
{
|
||||||
|
SetUserProperty(property.Key, property.Value.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置公共事件属性
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="propertys"></param>
|
||||||
|
public void SetSuperProperties(Dictionary<string, object> propertys)
|
||||||
|
{
|
||||||
|
if (superProperties == null)
|
||||||
|
{
|
||||||
|
superProperties = new Dictionary<string, object>();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var property in propertys)
|
||||||
|
{
|
||||||
|
superProperties[property.Key] = property.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
string json = JsonConvert.SerializeObject(superProperties);
|
||||||
|
PlayerPrefsUtils.SavePlayerPrefsString(KEY_SUPER_PROPERTIES, json);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// FireBase收益上报
|
/// FireBase收益上报
|
||||||
|
|
|
||||||
|
|
@ -16,5 +16,6 @@ public class FireBaseSDKManager : NormalSingleton<FireBaseSDKManager>
|
||||||
private void InitSDK()
|
private void InitSDK()
|
||||||
{
|
{
|
||||||
FireBaseRemoteConfigManager.Instance.FetchRemoteConfig();
|
FireBaseRemoteConfigManager.Instance.FetchRemoteConfig();
|
||||||
|
FireBaseAnalyticsManager.Instance.InitSuperProperties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,20 @@ public class ShuShuEvent : NormalSingleton<ShuShuEvent>
|
||||||
TDAnalytics.Track(eventName);
|
TDAnalytics.Track(eventName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发送事件
|
||||||
|
/// </summary>
|
||||||
|
public void Track(string eventName, string key1, object value1)
|
||||||
|
{
|
||||||
|
var extraInfo = new Dictionary<string, object>();
|
||||||
|
if (key1 != null && value1 != null)
|
||||||
|
{
|
||||||
|
extraInfo[key1] = value1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Track(eventName, extraInfo);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发送事件
|
/// 发送事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue