Compare commits
2 Commits
50c5627ac2
...
67abd081c8
| Author | SHA1 | Date |
|---|---|---|
|
|
67abd081c8 | |
|
|
400498af17 |
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Guru
|
||||
|
|
@ -115,7 +116,7 @@ namespace Guru
|
|||
|
||||
private void OnLoadMaxBanner()
|
||||
{
|
||||
_badsloadStartTime = Time.realtimeSinceStartup;
|
||||
_badsloadStartTime = DateTime.UtcNow;
|
||||
_chanelMax.LoadBannerAD();
|
||||
OnBannerStartLoad?.Invoke(_chanelMax.MaxBADSSlotID);
|
||||
}
|
||||
|
|
@ -147,7 +148,7 @@ namespace Guru
|
|||
}
|
||||
|
||||
private void OnLoadMaxIV() {
|
||||
_iadsLoadStartTime = Time.realtimeSinceStartup; // 更新计时器
|
||||
_iadsLoadStartTime = DateTime.UtcNow; // 更新计时器
|
||||
_chanelMax.LoadInterstitialAD();
|
||||
OnInterstitialStartLoad?.Invoke(_chanelMax.MaxIADSSlotID);
|
||||
}
|
||||
|
|
@ -180,7 +181,7 @@ namespace Guru
|
|||
|
||||
private void OnLoadMaxRV()
|
||||
{
|
||||
_radsLoadStartTime = Time.realtimeSinceStartup; // 更新计时器
|
||||
_radsLoadStartTime = DateTime.UtcNow; // 更新计时器
|
||||
_chanelMax.LoadRewardAD();
|
||||
OnRewardedStartLoad?.Invoke(_chanelMax.MaxRADSSlotID);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,11 +213,24 @@ namespace Guru
|
|||
|
||||
// #2 tch_001
|
||||
double revenue = impressionData.value;
|
||||
CalcTaichi001Value(revenue);
|
||||
CalcTaichi02Value(revenue);
|
||||
CalcTch001Value(revenue);
|
||||
CalcTch02Value(revenue);
|
||||
|
||||
// #3 adjust_ad_revenue
|
||||
AdjustService.TrackADRevenue(impressionData);
|
||||
|
||||
|
||||
var adType = impressionData.ad_format.ToUpper();
|
||||
// #4 Paid Event
|
||||
Debug.Log($"{Tag} --- ReportAdsRevenue :: Send Paid Event: {adType}");
|
||||
if (adType.Contains("INTER"))
|
||||
{
|
||||
OnInterstitialPaidEvent(impressionData);
|
||||
}
|
||||
else if (adType.Contains("REWARD"))
|
||||
{
|
||||
OnRewardedAdPaidEvent(impressionData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -238,7 +251,7 @@ namespace Guru
|
|||
else
|
||||
{
|
||||
// 找不到的话会缓存 adInfo, 等待获取 RCid
|
||||
_impressionCache[adInfo.CreativeIdentifier] = CreateImpressionData(adInfo, "", Analytics.AdMAX);
|
||||
SetImpressionData(adInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -281,7 +294,7 @@ namespace Guru
|
|||
/// 计算太极001收益
|
||||
/// </summary>
|
||||
/// <param name="revenue"></param>
|
||||
private void CalcTaichi001Value(double revenue)
|
||||
private void CalcTch001Value(double revenue)
|
||||
{
|
||||
TchAD001RevValue += revenue;
|
||||
double revenueValue = TchAD001RevValue;
|
||||
|
|
@ -298,7 +311,7 @@ namespace Guru
|
|||
/// 计算太极02收益
|
||||
/// </summary>
|
||||
/// <param name="revenue"></param>
|
||||
private void CalcTaichi02Value(double revenue)
|
||||
private void CalcTch02Value(double revenue)
|
||||
{
|
||||
if (!Analytics.EnableTch02Event) return;
|
||||
|
||||
|
|
@ -320,21 +333,25 @@ namespace Guru
|
|||
private string _backColorStr = "#50A436";
|
||||
private Color _backColor = new Color(0, 0, 0, 0);
|
||||
private string _badsCategory;
|
||||
protected float _badsloadStartTime = 0;
|
||||
protected DateTime _badsloadStartTime;
|
||||
private bool _bannerVisible = false;
|
||||
public bool IsBannerVisible => _bannerVisible;
|
||||
private int _badsloadedNum = 0;
|
||||
private int _badsLoadFailNum = 0;
|
||||
|
||||
|
||||
|
||||
private int GetAdsLoadDuration(ref float startTime)
|
||||
/// <summary>
|
||||
/// 获取动作间隔之间的毫秒数
|
||||
/// </summary>
|
||||
/// <param name="startTime"></param>
|
||||
/// <returns></returns>
|
||||
private int GetActionDuration(DateTime startTime)
|
||||
{
|
||||
int duration = (int)((Time.realtimeSinceStartup - startTime) * 1000);
|
||||
startTime = Time.realtimeSinceStartup;
|
||||
return duration;
|
||||
var sp = DateTime.UtcNow.Subtract(startTime.ToUniversalTime()).Duration();
|
||||
return (int) sp.TotalMilliseconds;
|
||||
}
|
||||
|
||||
|
||||
public virtual void RequestBannerAD()
|
||||
{
|
||||
_backColor = Color.clear;
|
||||
|
|
@ -365,12 +382,12 @@ namespace Guru
|
|||
|
||||
public void OnLoadBads()
|
||||
{
|
||||
_badsloadStartTime = Time.realtimeSinceStartup;
|
||||
_badsloadStartTime = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
protected virtual void OnBadsLoaded()
|
||||
{
|
||||
_badsloadStartTime = Time.realtimeSinceStartup;
|
||||
_badsloadStartTime = DateTime.UtcNow;
|
||||
OnBannerLoaded?.Invoke();
|
||||
}
|
||||
|
||||
|
|
@ -446,7 +463,7 @@ namespace Guru
|
|||
_badsLoadFailNum ++;
|
||||
// Analytics.ADBadsFailed(adUnitId, (int)errorInfo.Code, GetAdsLoadDuration(ref _badsloadStartTime), _badsCategory);
|
||||
Analytics.ADBadsFailed(AdParams.Build(adUnitId,
|
||||
duration: GetAdsLoadDuration(ref _badsloadStartTime), category: _badsCategory,
|
||||
duration: GetActionDuration(_badsloadStartTime), category: _badsCategory,
|
||||
errorCode: (int)errorInfo.Code,
|
||||
waterfallName: errorInfo?.WaterfallInfo?.Name ?? ""));
|
||||
}
|
||||
|
|
@ -488,9 +505,12 @@ namespace Guru
|
|||
|
||||
private string _iadsCategory = "main";
|
||||
private int _interstitialRetryAttempt;
|
||||
protected float _iadsLoadStartTime;
|
||||
private Action _interCloseAction;
|
||||
protected bool _isIadsLoading = false;
|
||||
protected DateTime _iadsLoadStartTime;
|
||||
private DateTime _iadsDisplayStartTime;
|
||||
|
||||
|
||||
public bool IsIadsLoading => _isIadsLoading;
|
||||
|
||||
public virtual void RequestInterstitialAD()
|
||||
|
|
@ -514,7 +534,7 @@ namespace Guru
|
|||
|
||||
public void OnLoadIads()
|
||||
{
|
||||
_iadsLoadStartTime = Time.realtimeSinceStartup;
|
||||
_iadsLoadStartTime = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -548,6 +568,7 @@ namespace Guru
|
|||
_interCloseAction = dismissAction;
|
||||
MaxSdk.ShowInterstitial(GetInterstitialID());
|
||||
|
||||
_iadsDisplayStartTime = DateTime.UtcNow;
|
||||
// RequestInterstitialAD(); // 直接加载下一个广告
|
||||
}
|
||||
|
||||
|
|
@ -558,7 +579,7 @@ namespace Guru
|
|||
// Reset retry attempt
|
||||
// Analytics.ADIadsLoaded(adUnitId, GetAdsLoadDuration(ref _iadsLoadStartTime), _iadsCategory);
|
||||
Analytics.ADIadsLoaded(AdParams.Build(adUnitId,
|
||||
duration: GetAdsLoadDuration(ref _iadsLoadStartTime), category: _iadsCategory));
|
||||
duration: GetActionDuration(_iadsLoadStartTime), category: _iadsCategory));
|
||||
_interstitialRetryAttempt = 0;
|
||||
|
||||
Debug.Log( $"[SDK][Ads][Loaded] --- adUnitId:{adUnitId} Revenue:{adInfo.Revenue} Type:{adInfo.AdFormat} CreativeId:{adInfo.CreativeIdentifier}");
|
||||
|
|
@ -577,8 +598,9 @@ namespace Guru
|
|||
float retryDelay = GetRetryDelaySeconds(_interstitialRetryAttempt);
|
||||
DelayCall(retryDelay, RequestInterstitialAD);
|
||||
// Analytics.ADIadsFailed(adUnitId, (int)errorInfo.Code, GetAdsLoadDuration(ref _iadsLoadStartTime), _iadsCategory);
|
||||
if(string.IsNullOrEmpty(_iadsCategory)) _iadsCategory = "not_set";
|
||||
Analytics.ADIadsFailed(AdParams.Build(adUnitId,
|
||||
duration: GetAdsLoadDuration(ref _iadsLoadStartTime), category: _iadsCategory,
|
||||
duration: GetActionDuration(_iadsLoadStartTime), category: _iadsCategory,
|
||||
errorCode: (int)errorInfo.Code,
|
||||
waterfallName: errorInfo?.WaterfallInfo?.Name ?? ""));
|
||||
|
||||
|
|
@ -593,42 +615,65 @@ namespace Guru
|
|||
$"InterstitialFailedToDisplayEvent AdLoadFailureInfo:{errorInfo.AdLoadFailureInfo}, Message: {errorInfo.Message}");
|
||||
// Analytics.ADIadsFailed(adUnitId, (int)errorInfo.Code, GetAdsLoadDuration(ref _iadsLoadStartTime), _iadsCategory);
|
||||
Analytics.ADIadsFailed(AdParams.Build(adUnitId,
|
||||
duration: GetAdsLoadDuration(ref _iadsLoadStartTime), category: _iadsCategory,
|
||||
duration: GetActionDuration(_iadsDisplayStartTime), category: _iadsCategory,
|
||||
errorCode: (int)errorInfo.Code,
|
||||
waterfallName: errorInfo?.WaterfallInfo?.Name ?? ""));
|
||||
DelayCall(2.0f, RequestInterstitialAD);
|
||||
}
|
||||
|
||||
// iads_imp
|
||||
protected virtual void OnInterstitialDisplayEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Analytics.ADIadsImp(adUnitId, _iadsCategory);
|
||||
Analytics.ADIadsImp(AdParams.Build(adUnitId, category: _iadsCategory));
|
||||
string reviewCreativeId = GetReviewCreativeId(adInfo.CreativeIdentifier);
|
||||
Analytics.ADIadsImp(AdParams.Build(adUnitId, adInfo, category: _iadsCategory, reviewCreativeId:reviewCreativeId));
|
||||
}
|
||||
|
||||
protected virtual void OnInterstitialClickEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Analytics.ADIadsClick(adUnitId, _iadsCategory);
|
||||
Analytics.ADIadsClick(AdParams.Build(adUnitId, category: _iadsCategory));
|
||||
string reviewCreativeId = GetReviewCreativeId(adInfo.CreativeIdentifier);
|
||||
var impressionData = CreateImpressionData(adInfo, reviewCreativeId);
|
||||
var data = impressionData.BuildEventData();
|
||||
if(string.IsNullOrEmpty(_iadsCategory)) _iadsCategory = "not_set";
|
||||
data["item_category"] = _iadsCategory;
|
||||
data.Remove("ad_format");
|
||||
Analytics.ADIadsClick(data);
|
||||
}
|
||||
|
||||
// Close
|
||||
protected virtual void OnInterstitialDismissedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
// Interstitial ad is hidden. Pre-load the next ad
|
||||
_interCloseAction?.Invoke();
|
||||
OnInterstitialClosed?.Invoke();
|
||||
// Analytics.ADIadsClose(adUnitId, _iadsCategory);
|
||||
Analytics.ADIadsClose(AdParams.Build(adUnitId, category: _iadsCategory));
|
||||
Analytics.ADIadsClose(AdParams.Build(adUnitId,
|
||||
duration:GetActionDuration(_iadsDisplayStartTime),
|
||||
category: _iadsCategory));
|
||||
|
||||
//延时加载下一个广告
|
||||
DelayCall(2.0f, RequestInterstitialAD);
|
||||
}
|
||||
|
||||
private void OnInterstitialPaidEvent(AdImpressionData impressionData)
|
||||
{
|
||||
var data = impressionData.BuildEventData();
|
||||
if(string.IsNullOrEmpty(_iadsCategory)) _iadsCategory = "not_set";
|
||||
data["item_category"] = _iadsCategory;
|
||||
data.Remove("ad_format");
|
||||
Analytics.ADIadsPaid(data);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Rewarded Ads
|
||||
|
||||
private string _rewardCategory = "main";
|
||||
private int _rewardRetryAttempt;
|
||||
protected float _radsLoadStartTime;
|
||||
protected DateTime _radsLoadStartTime;
|
||||
protected DateTime _radsShowStartTime;
|
||||
private Action _rvRewardAction;
|
||||
private Action<string> _rvFailAction;
|
||||
private Action _rvDismissAction;
|
||||
|
|
@ -661,7 +706,7 @@ namespace Guru
|
|||
|
||||
public void OnLoadRads()
|
||||
{
|
||||
_radsLoadStartTime = Time.realtimeSinceStartup;
|
||||
_radsLoadStartTime = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -700,6 +745,8 @@ namespace Guru
|
|||
_rvDismissAction = dismissAction;
|
||||
MaxSdk.ShowRewardedAd(GetRewardedID());
|
||||
|
||||
_radsShowStartTime = DateTime.UtcNow;
|
||||
|
||||
// RequestRewardedAD();
|
||||
}
|
||||
|
||||
|
|
@ -712,7 +759,7 @@ namespace Guru
|
|||
// this.Log("OnRewardedAdLoadedEvent");
|
||||
// Analytics.ADRadsLoaded(adUnitId, GetAdsLoadDuration(ref _radsLoadStartTime), _rewardCategory);
|
||||
Analytics.ADRadsLoaded(AdParams.Build(adUnitId,
|
||||
duration: GetAdsLoadDuration(ref _radsLoadStartTime), category: _iadsCategory));
|
||||
duration: GetActionDuration(_radsLoadStartTime), category: _iadsCategory));
|
||||
_rewardRetryAttempt = 0;
|
||||
|
||||
Debug.Log( $"[SDK][Ads][Loaded] --- adUnitId:{adUnitId} Revenue:{adInfo.Revenue} Type:{adInfo.AdFormat} CreativeId:{adInfo.CreativeIdentifier}");
|
||||
|
|
@ -730,7 +777,7 @@ namespace Guru
|
|||
$"OnRewardedAdFailedEvent AdLoadFailureInfo:{errorInfo.AdLoadFailureInfo}, Message: {errorInfo.Message}");
|
||||
// Analytics.ADRadsFailed(adUnitId, (int)errorInfo.Code, GetAdsLoadDuration(ref _radsLoadStartTime), _rewardCategory);
|
||||
Analytics.ADRadsFailed(AdParams.Build(adUnitId,
|
||||
duration: GetAdsLoadDuration(ref _radsLoadStartTime), category: _rewardCategory,
|
||||
duration: GetActionDuration(_radsLoadStartTime), category: _rewardCategory,
|
||||
errorCode: (int)errorInfo.Code,
|
||||
waterfallName: errorInfo?.WaterfallInfo?.Name ?? ""));
|
||||
_rewardRetryAttempt++;
|
||||
|
|
@ -748,7 +795,7 @@ namespace Guru
|
|||
$"OnRewardedAdFailedToDisplayEvent AdLoadFailureInfo:{errorInfo.AdLoadFailureInfo}, Message: {errorInfo.Message}");
|
||||
// Analytics.ADRadsFailed(adUnitId, (int)errorInfo.Code, GetAdsLoadDuration(ref _radsLoadStartTime), _rewardCategory);
|
||||
Analytics.ADRadsFailed(AdParams.Build(adUnitId,
|
||||
duration: GetAdsLoadDuration(ref _radsLoadStartTime), category: _rewardCategory,
|
||||
duration: GetActionDuration(_radsShowStartTime), category: _rewardCategory,
|
||||
errorCode: (int)errorInfo.Code,
|
||||
waterfallName: errorInfo?.WaterfallInfo?.Name ?? ""));
|
||||
_rvFailAction?.Invoke("OnRewardedAdFailedToDisplayEvent");
|
||||
|
|
@ -761,16 +808,23 @@ namespace Guru
|
|||
{
|
||||
this.Log("OnRewardedAdDisplayedEvent");
|
||||
// Analytics.ADRadsImp(adUnitId, _rewardCategory);
|
||||
Analytics.ADRadsImp(AdParams.Build(adUnitId, category: _rewardCategory));
|
||||
string reviewCreativeId = GetReviewCreativeId(adInfo.CreativeIdentifier);
|
||||
Analytics.ADRadsImp(AdParams.Build(adUnitId, adInfo, category: _rewardCategory, reviewCreativeId:reviewCreativeId));
|
||||
}
|
||||
|
||||
protected virtual void OnRewardedAdClickedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
this.Log("OnRewardedAdClickedEvent");
|
||||
// Analytics.ADRadsClick(adUnitId, _rewardCategory);
|
||||
Analytics.ADRadsClick(AdParams.Build(adUnitId, category: _rewardCategory));
|
||||
var impressionData = CreateImpressionData(adInfo, GetReviewCreativeId(adInfo.CreativeIdentifier));
|
||||
var data = impressionData.BuildEventData();
|
||||
if(string.IsNullOrEmpty(_rewardCategory)) _rewardCategory = "not_set";
|
||||
data["item_category"] = _rewardCategory;
|
||||
data.Remove("ad_format");
|
||||
Analytics.ADRadsClick(data);
|
||||
}
|
||||
|
||||
// rads_close
|
||||
protected virtual void OnRewardedAdDismissedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
this.Log("OnRewardedAdDismissedEvent");
|
||||
|
|
@ -779,24 +833,37 @@ namespace Guru
|
|||
OnRewardClosed?.Invoke();
|
||||
|
||||
// Analytics.ADRadsClose(adUnitId, _rewardCategory);
|
||||
Analytics.ADRadsClose(AdParams.Build(adUnitId, category: _rewardCategory));
|
||||
Analytics.ADRadsClose(AdParams.Build(adUnitId, duration:GetActionDuration(_radsShowStartTime), category: _rewardCategory));
|
||||
|
||||
//延时加载下一个广告
|
||||
DelayCall(2.0f, RequestRewardedAD);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// rads_rewarded
|
||||
protected virtual void OnRewardedAdReceivedRewardEvent(string adUnitId, MaxSdk.Reward reward,
|
||||
MaxSdkBase.AdInfo arg3)
|
||||
MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
this.Log("OnRewardedAdReceivedRewardEvent");
|
||||
// Analytics.ADRadsRewarded(adUnitId, _rewardCategory);
|
||||
Analytics.ADRadsRewarded(AdParams.Build(adUnitId, category: _rewardCategory));
|
||||
var impressionData = CreateImpressionData(adInfo, GetReviewCreativeId(adInfo.CreativeIdentifier));
|
||||
var data = impressionData.BuildEventData();
|
||||
if(string.IsNullOrEmpty(_rewardCategory)) _rewardCategory = "not_set";
|
||||
data["item_category"] = _rewardCategory;
|
||||
data.Remove("ad_format");
|
||||
Analytics.ADRadsRewarded(data);
|
||||
// Rewarded ad was displayed and user should receive the reward
|
||||
_rvRewardAction?.Invoke();
|
||||
}
|
||||
|
||||
// rads_paid
|
||||
private void OnRewardedAdPaidEvent(AdImpressionData impressionData)
|
||||
{
|
||||
var data = impressionData.BuildEventData();
|
||||
if(string.IsNullOrEmpty(_rewardCategory)) _rewardCategory = "not_set";
|
||||
data["item_category"] = _rewardCategory;
|
||||
data.Remove("ad_format");
|
||||
Analytics.ADRadsPaid(data);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Ad Settings
|
||||
|
|
@ -841,6 +908,35 @@ namespace Guru
|
|||
|
||||
#region CreativeID
|
||||
|
||||
private string GetReviewCreativeId(string creativeId)
|
||||
{
|
||||
if (_reviewCreativeIds == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
if (_reviewCreativeIds.TryGetValue(creativeId, out var reviewCreativeId))
|
||||
{
|
||||
return reviewCreativeId;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private void SetReviewCreativeId(string creativeId, string reviewCreativeId)
|
||||
{
|
||||
if (_reviewCreativeIds == null) _reviewCreativeIds = new Dictionary<string, string>(10);
|
||||
|
||||
if (string.IsNullOrEmpty(reviewCreativeId)) return;
|
||||
|
||||
_reviewCreativeIds[creativeId] = reviewCreativeId;
|
||||
}
|
||||
|
||||
private void SetImpressionData(MaxSdkBase.AdInfo adInfo, string reviewCreativeId = "", string platform = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(platform)) platform = Analytics.AdMAX;
|
||||
_impressionCache[adInfo.CreativeIdentifier] = CreateImpressionData(adInfo, reviewCreativeId, platform);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取 AdReviewCreativeId
|
||||
/// </summary>
|
||||
|
|
@ -856,14 +952,8 @@ namespace Guru
|
|||
return;
|
||||
}
|
||||
|
||||
if (_reviewCreativeIds == null) _reviewCreativeIds = new Dictionary<string, string>(10);
|
||||
|
||||
|
||||
// 尝试直接上报广告收益 (可能存在异步上报的情况)
|
||||
if (!TryReportImpression(adInfo, reviewCreativeId))
|
||||
{
|
||||
_reviewCreativeIds[adInfo.CreativeIdentifier] = reviewCreativeId; // 如果上报未成功, 则缓存reviewCreativeId
|
||||
}
|
||||
TryReportImpression(adInfo, reviewCreativeId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -872,10 +962,9 @@ namespace Guru
|
|||
/// <param name="adInfo"></param>
|
||||
/// <param name="reviewCreativeId"></param>
|
||||
/// <returns></returns>
|
||||
private bool TryReportImpression(MaxSdk.AdInfo adInfo, string reviewCreativeId = "")
|
||||
private void TryReportImpression(MaxSdk.AdInfo adInfo, string reviewCreativeId = "")
|
||||
{
|
||||
string creativeId = adInfo.CreativeIdentifier;
|
||||
bool result = false;
|
||||
List<string> removeList = new List<string>();
|
||||
|
||||
if (_impressionCache.TryGetValue(creativeId, out var impressionData))
|
||||
|
|
@ -885,7 +974,11 @@ namespace Guru
|
|||
|
||||
ReportAdsRevenue(impressionData);
|
||||
removeList.Add(creativeId);
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果上报未成功, 则缓存reviewCreativeId
|
||||
SetReviewCreativeId(adInfo.CreativeIdentifier, reviewCreativeId);
|
||||
}
|
||||
|
||||
// 清理超过 3 秒未上报的数据
|
||||
|
|
@ -906,8 +999,6 @@ namespace Guru
|
|||
_reviewCreativeIds.Remove(k);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Guru
|
||||
{
|
||||
using System;
|
||||
|
|
@ -36,5 +38,23 @@ namespace Guru
|
|||
}
|
||||
|
||||
|
||||
public Dictionary<string, object> BuildEventData()
|
||||
{
|
||||
var data = new Dictionary<string, object>()
|
||||
{
|
||||
{ "value", value },
|
||||
{ "currency", currency },
|
||||
{ "ad_platform", ad_platform },
|
||||
{ "ad_format", ad_format },
|
||||
{ "ad_source", ad_source },
|
||||
{ "ad_unit_name", ad_unit_name },
|
||||
{ "ad_placement", ad_placement },
|
||||
{ "ad_creative_id", ad_creative_id },
|
||||
{ "review_creative_id", review_creative_id },
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -36,15 +36,37 @@ namespace Guru
|
|||
|
||||
if (adParams.duration > 0)
|
||||
data[ParameterDuration] = adParams.duration;
|
||||
|
||||
if (adParams.errorCode != 0)
|
||||
data[ParameterErrorCode] = adParams.errorCode;
|
||||
|
||||
if (!string.IsNullOrEmpty(adParams.networkName))
|
||||
data[ParameterNetworkName] = adParams.networkName;
|
||||
|
||||
if (!string.IsNullOrEmpty(adParams.networkPlacement))
|
||||
{
|
||||
data[ParameterNetworkPlacement] = adParams.networkPlacement;
|
||||
data[ParameterAdPlacement] = adParams.networkPlacement;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(adParams.waterfallName))
|
||||
data[ParameterWaterfall] = adParams.waterfallName;
|
||||
|
||||
if (!string.IsNullOrEmpty(adParams.creativeId))
|
||||
data[ParameterAdCreativeId] = adParams.creativeId;
|
||||
|
||||
if (!string.IsNullOrEmpty(adParams.reviewCreativeId))
|
||||
data[ParameterReviewCreativeId] = adParams.reviewCreativeId;
|
||||
|
||||
if (!string.IsNullOrEmpty(adParams.adPlatform))
|
||||
data[ParameterAdPlatform] = adParams.adPlatform;
|
||||
|
||||
if (!string.IsNullOrEmpty(adParams.adSource))
|
||||
data[ParameterAdSource] = adParams.adSource;
|
||||
|
||||
if (!string.IsNullOrEmpty(adParams.adFormat))
|
||||
data[ParameterAdFormat] = adParams.adFormat;
|
||||
|
||||
if (extra != null && extra.Count > 0)
|
||||
{
|
||||
foreach (var k in extra.Keys)
|
||||
|
|
@ -128,7 +150,12 @@ namespace Guru
|
|||
/// </summary>
|
||||
public static void ADIadsClick(AdParams adParams)
|
||||
{
|
||||
TrackEvent(EventIadsClick, BuildAdEventData(adParams));
|
||||
ADIadsClick(BuildAdEventData(adParams));
|
||||
}
|
||||
|
||||
public static void ADIadsClick(Dictionary<string, object> data)
|
||||
{
|
||||
TrackEvent(EventIadsClick, data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -139,6 +166,15 @@ namespace Guru
|
|||
TrackEvent(EventIadsClose, BuildAdEventData(adParams));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 插屏广告收到奖励
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
public static void ADIadsPaid(Dictionary<string, object> data)
|
||||
{
|
||||
TrackEvent(EventIadsPaid, data);
|
||||
}
|
||||
|
||||
//---------------------- REWARDS -------------------------
|
||||
/// <summary>
|
||||
/// 广告开始加载
|
||||
|
|
@ -173,7 +209,11 @@ namespace Guru
|
|||
/// </summary>
|
||||
public static void ADRadsRewarded(AdParams adParams)
|
||||
{
|
||||
var data = BuildAdEventData(adParams);
|
||||
ADRadsRewarded(BuildAdEventData(adParams));
|
||||
}
|
||||
|
||||
public static void ADRadsRewarded(Dictionary<string, object> data)
|
||||
{
|
||||
TrackEvent(EventRadsRewarded, data);
|
||||
|
||||
if (RadsRewardCount == 0)
|
||||
|
|
@ -183,6 +223,15 @@ namespace Guru
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 插屏广告收到奖励
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
public static void ADRadsPaid(Dictionary<string, object> data)
|
||||
{
|
||||
TrackEvent(EventRadsPaid, data);
|
||||
}
|
||||
|
||||
|
||||
private static int RadsRewardCount
|
||||
{
|
||||
|
|
@ -203,7 +252,12 @@ namespace Guru
|
|||
/// </summary>
|
||||
public static void ADRadsClick(AdParams adParams)
|
||||
{
|
||||
TrackEvent(EventRadsClick, BuildAdEventData(adParams));
|
||||
ADRadsClick(BuildAdEventData(adParams));
|
||||
}
|
||||
|
||||
public static void ADRadsClick(Dictionary<string, object> data)
|
||||
{
|
||||
TrackEvent(EventRadsClick, data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -260,10 +314,15 @@ namespace Guru
|
|||
public string category;
|
||||
public string networkName;
|
||||
public string networkPlacement;
|
||||
public string adPlatform;
|
||||
public string adSource;
|
||||
public string adFormat;
|
||||
public string waterfallName;
|
||||
public string adUnitId;
|
||||
public int errorCode = 0;
|
||||
public int duration = 0;
|
||||
public string creativeId;
|
||||
public string reviewCreativeId;
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -275,31 +334,47 @@ namespace Guru
|
|||
/// <param name="duration"></param>
|
||||
/// <param name="errorCode"></param>
|
||||
/// <param name="waterfallName"></param>
|
||||
/// <param name="reviewCreativeId"></param>
|
||||
/// <param name="adPlatform"></param>
|
||||
/// <returns></returns>
|
||||
public static AdParams Build(string adUnitId, MaxSdkBase.AdInfo adInfo = null, string category = "",
|
||||
int duration = 0, int errorCode = 0, string waterfallName = "")
|
||||
int duration = 0, int errorCode = 0, string waterfallName = "", string reviewCreativeId = "", string adPlatform = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(adUnitId) && adInfo != null) adUnitId = adInfo.AdUnitIdentifier;
|
||||
var networkName = "";
|
||||
var networkPlacement = "";
|
||||
var creativeId = "";
|
||||
var adSource = "";
|
||||
var adFormart = "";
|
||||
|
||||
if (string.IsNullOrEmpty(adPlatform)) adPlatform = Analytics.AdMAX;
|
||||
if (adInfo != null)
|
||||
{
|
||||
networkName = adInfo.NetworkName;
|
||||
networkPlacement = adInfo.NetworkPlacement;
|
||||
creativeId = adInfo.CreativeIdentifier;
|
||||
adSource = adInfo.NetworkName;
|
||||
adFormart = adInfo.AdFormat;
|
||||
|
||||
if (string.IsNullOrEmpty(waterfallName))
|
||||
waterfallName = adInfo.WaterfallInfo?.Name ?? "";
|
||||
|
||||
}
|
||||
|
||||
var p = new AdParams()
|
||||
{
|
||||
adUnitId = adUnitId,
|
||||
adPlatform = adPlatform,
|
||||
adSource = adSource,
|
||||
adFormat = adFormart,
|
||||
duration = duration,
|
||||
networkName = networkName,
|
||||
networkPlacement = networkPlacement,
|
||||
waterfallName = waterfallName,
|
||||
category = category,
|
||||
errorCode = errorCode,
|
||||
creativeId = creativeId,
|
||||
reviewCreativeId = reviewCreativeId,
|
||||
};
|
||||
return p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ namespace Guru
|
|||
/// </summary>
|
||||
public static void SetUserProperty(string propertyName, string propertyValue)
|
||||
{
|
||||
Log.I(TAG,$"SetUserProperty -> propertyName:{propertyName}, propertyValue:{propertyValue}");
|
||||
Debug.Log($"{TAG} --- SetUserProperty -> propertyName:{propertyName}, propertyValue:{propertyValue}");
|
||||
|
||||
if (!IsReady)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,24 @@ PluginImporter:
|
|||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
|
|
@ -21,13 +39,42 @@ PluginImporter:
|
|||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: true
|
||||
AddToEmbeddedBinaries: false
|
||||
CPU: AnyCPU
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ec7317011341a40a1a0ee7ae5f38f270
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a4ccb52ed7f6b4dff8731e9e93293ccb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#if 0
|
||||
#elif defined(__arm64__) && __arm64__
|
||||
// Generated by Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
|
||||
// Generated by Apple Swift version 5.9.2 effective-4.1.50 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
|
||||
#ifndef CONNECTIVITY_SWIFT_H
|
||||
#define CONNECTIVITY_SWIFT_H
|
||||
#pragma clang diagnostic push
|
||||
|
|
@ -318,7 +318,7 @@ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _No
|
|||
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull CONNECTIVITY_OTHER;)
|
||||
+ (NSString * _Nonnull)CONNECTIVITY_OTHER SWIFT_WARN_UNUSED_RESULT;
|
||||
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
|
||||
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
|
||||
+ (nonnull instancetype)new SWIFT_DEPRECATED_MSG("-init is unavailable");
|
||||
- (void)initializeWithCompletion:(void (^ _Nonnull)(BOOL))completion;
|
||||
- (NSArray<NSString *> * _Nonnull)checkConnectionType SWIFT_WARN_UNUSED_RESULT;
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c7072e499221b489e8a171a746c1d381
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b3be6515c98fc4516b74799d2232851a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 009197294dbfe4bd5b64f833fce7277e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: db929fad7809a40a6af254c5262adb3a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d014052e45f6948db82f9fbecdb02a96
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5a2b967c5b7f944adb348971a0e13c79
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b8637a4450c6b4ca895cd05427db6ffc
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2b7b377a06cfe4472ace76077b0d1e24
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: be5b523ba98e649d9938fc7df1e7b55a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 97a465fd6df3b4f72a477ef19bf727a9
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1a90376b0826241cf8ed25c4ba2b91fc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -6,15 +6,15 @@
|
|||
<dict>
|
||||
<key>Headers/Connectivity-Swift.h</key>
|
||||
<data>
|
||||
yQkPWwZ2klcFBQT3c4PI/gTVVAE=
|
||||
2jZWRNZEB9lWoT02/WI0gpx8bUY=
|
||||
</data>
|
||||
<key>Info.plist</key>
|
||||
<data>
|
||||
n4FM+14bzgCqiae7BEnOfj78dFA=
|
||||
lVs8E6FtUHvDAsoK7zwpgZ+1m84=
|
||||
</data>
|
||||
<key>Modules/Connectivity.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo</key>
|
||||
<data>
|
||||
KGmpTymRqrX9y4GV/j+eFuhhTYM=
|
||||
3vRjRUNrw8fWaShfTaH+cBfxfLE=
|
||||
</data>
|
||||
<key>Modules/Connectivity.swiftmodule/arm64-apple-ios.abi.json</key>
|
||||
<data>
|
||||
|
|
@ -22,11 +22,11 @@
|
|||
</data>
|
||||
<key>Modules/Connectivity.swiftmodule/arm64-apple-ios.swiftdoc</key>
|
||||
<data>
|
||||
NaKg9acNtBzWngYfwx3Nt50tA5o=
|
||||
HgPMAkcK2+NGvcVfwyFJ9u/nd0k=
|
||||
</data>
|
||||
<key>Modules/Connectivity.swiftmodule/arm64-apple-ios.swiftmodule</key>
|
||||
<data>
|
||||
TBHp8ndBz6+t9eK5i+Q7XONqD+w=
|
||||
nK9APrK3atZTGuid35+A6Dde02M=
|
||||
</data>
|
||||
<key>Modules/module.modulemap</key>
|
||||
<data>
|
||||
|
|
@ -39,14 +39,14 @@
|
|||
<dict>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
HIhSgITt+HNjHvu2O1pDvyjgx9HdyI801+Q9Bn92Suc=
|
||||
xwPPIVygOJDaH/CCrDO25Y2645Q/IQYSiJrV3eJJy+M=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Modules/Connectivity.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo</key>
|
||||
<dict>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
HnYY+N0JWfujm6LckQtevFuYEFW4uYx4hcAkaFgCZp0=
|
||||
Qgk/xiutw35xy8VeU5niELPbBEi5gVVuXYai3rhRrbI=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Modules/Connectivity.swiftmodule/arm64-apple-ios.abi.json</key>
|
||||
|
|
@ -60,14 +60,14 @@
|
|||
<dict>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
sgsu9CnSXAG3fxoW1HBRLZ9lCTX38BR3y2eik7e37zU=
|
||||
ZNpy4/pGL15IFXpHTav2UvUYM7kQPN/0eTjxtfLqYq8=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Modules/Connectivity.swiftmodule/arm64-apple-ios.swiftmodule</key>
|
||||
<dict>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
S73u4XvAyezKkKReZVBDl16w7MSeeI6FBXUJ9OirCI4=
|
||||
Et4EI2nA28WHGnFW0ki2IUjCTs703CjwdRvol0loQGo=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Modules/module.modulemap</key>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 158f1aee738db4ad8a07a36e89614060
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue