Compare commits
No commits in common. "7119ae470f4ee69d3f8ad5f901548bd9c01bdd76" and "6774b4af7ac214f5c0e88b574b4d2621fb71ff40" have entirely different histories.
7119ae470f
...
6774b4af7a
|
|
@ -1,48 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using AdjustSdk;
|
||||
using AdjustSdk;
|
||||
using Firebase.RemoteConfig;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
using WZ;
|
||||
|
||||
public class AdjustTrackEvent : NormalSingleton<AdjustTrackEvent>
|
||||
{
|
||||
private Dictionary<string, string> eventTokenMap;
|
||||
|
||||
|
||||
private string GetEventToken(string eventName)
|
||||
public class AdjustTrackEvent : D_MonoSingleton<AdjustTrackEvent>
|
||||
{
|
||||
if (eventTokenMap == null)
|
||||
{
|
||||
UpdateEventToken();
|
||||
}
|
||||
|
||||
if (eventTokenMap == null || eventTokenMap.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return eventTokenMap.GetValueOrDefault(eventName, null);
|
||||
}
|
||||
|
||||
public void UpdateEventToken()
|
||||
{
|
||||
var remoteConfigString = FireBaseRemoteConfigManager.Instance.GetRemoteConfigString("event_adjust_set");
|
||||
if (string.IsNullOrEmpty(remoteConfigString)) return;
|
||||
|
||||
var deserializeObject = JsonConvert.DeserializeObject<Dictionary<string, string>>(remoteConfigString);
|
||||
if (eventTokenMap == null)
|
||||
{
|
||||
eventTokenMap = deserializeObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var keyValuePair in deserializeObject)
|
||||
{
|
||||
eventTokenMap[keyValuePair.Key] = keyValuePair.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// adjust事件上报
|
||||
/// </summary>
|
||||
|
|
@ -53,32 +16,6 @@ public class AdjustTrackEvent : NormalSingleton<AdjustTrackEvent>
|
|||
Adjust.TrackEvent(adjustEvent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 会将eventName 转化成 token 进行上报
|
||||
/// </summary>
|
||||
/// <param name="eventName"></param>
|
||||
/// <param name="extraInfo"></param>
|
||||
public void TrackEventName(string eventName, Dictionary<string, object> extraInfo)
|
||||
{
|
||||
var eventToken = GetEventToken(eventName);
|
||||
if (string.IsNullOrEmpty(eventToken))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var adjustEvent = new AdjustEvent(eventToken);
|
||||
if (extraInfo != null)
|
||||
{
|
||||
foreach (var keyValuePair in extraInfo)
|
||||
{
|
||||
adjustEvent.AddPartnerParameter(keyValuePair.Key, keyValuePair.Value.ToString());
|
||||
adjustEvent.AddCallbackParameter(keyValuePair.Key, keyValuePair.Value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
Adjust.TrackEvent(adjustEvent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 广告收益上报
|
||||
/// </summary>
|
||||
|
|
@ -110,7 +47,6 @@ public class AdjustTrackEvent : NormalSingleton<AdjustTrackEvent>
|
|||
{
|
||||
return source;
|
||||
}
|
||||
|
||||
var revenueAdjs = JsonConvert.DeserializeObject<RevenueData[]>(json);
|
||||
if (revenueAdjs == null && revenueAdjs.Length == 0)
|
||||
{
|
||||
|
|
@ -123,9 +59,8 @@ public class AdjustTrackEvent : NormalSingleton<AdjustTrackEvent>
|
|||
{
|
||||
totalRate += item.rate;
|
||||
}
|
||||
|
||||
//开始随机
|
||||
int randomValue = Random.Range(0, totalRate);
|
||||
int randomValue = UnityEngine.Random.Range(0, totalRate);
|
||||
int accumulatedRate = 0;
|
||||
|
||||
//根据随机值定位
|
||||
|
|
|
|||
|
|
@ -257,25 +257,18 @@ public class AppSDKManager : D_MonoSingleton<AppSDKManager>
|
|||
{
|
||||
ShuShuEvent.Instance.Track(eventName);
|
||||
FireBaseAnalyticsManager.Instance.LogEvent(eventName);
|
||||
AdjustTrackEvent.Instance.TrackEventName(eventName, new Dictionary<string, object>());
|
||||
}
|
||||
|
||||
public void LogEvent(string eventName, string key1, object value1)
|
||||
{
|
||||
ShuShuEvent.Instance.Track(eventName, key1, value1);
|
||||
FireBaseAnalyticsManager.Instance.LogEvent(eventName, key1, value1);
|
||||
AdjustTrackEvent.Instance.TrackEventName(eventName, new Dictionary<string, object>
|
||||
{
|
||||
[key1] = value1
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void LogEvent(string eventName, Dictionary<string, object> extraInfo)
|
||||
{
|
||||
ShuShuEvent.Instance.Track(eventName, extraInfo);
|
||||
FireBaseAnalyticsManager.Instance.LogEvent(eventName, extraInfo);
|
||||
AdjustTrackEvent.Instance.TrackEventName(eventName, extraInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -10,15 +10,14 @@ namespace WZ
|
|||
{
|
||||
public void FetchRemoteConfig()
|
||||
{
|
||||
// Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
|
||||
// {
|
||||
// if (task.Result == Firebase.DependencyStatus.Available)
|
||||
// {
|
||||
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
|
||||
{
|
||||
if (task.Result == Firebase.DependencyStatus.Available)
|
||||
{
|
||||
Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.FetchAsync(TimeSpan.Zero).ContinueWithOnMainThread(task =>
|
||||
{
|
||||
FirebaseRemoteConfig.DefaultInstance.ActivateAsync().ContinueWithOnMainThread(task =>
|
||||
{
|
||||
AdjustTrackEvent.Instance.UpdateEventToken();
|
||||
// 获取广告位信息
|
||||
AdConfigParser.Parse(GetRemoteConfigString("ad_config"));
|
||||
// 刷新广告位信息
|
||||
|
|
@ -37,8 +36,8 @@ namespace WZ
|
|||
// 检查Adjust归因
|
||||
});
|
||||
});
|
||||
// }
|
||||
// });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void GroupSet()
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ namespace WZ
|
|||
{
|
||||
public void Init()
|
||||
{
|
||||
// if (Application.isEditor)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
if (Application.isEditor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
InitSDK();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue