修复kwai上报广告位ID问题
This commit is contained in:
parent
d5ec0e9ab1
commit
72be82d9f1
|
@ -244,16 +244,16 @@ namespace WZ
|
|||
#endregion
|
||||
|
||||
#region 收益上报
|
||||
public void TrackAdImpression(AdsType type)
|
||||
public void TrackAdImpression(AdsType type,string adUnitId)
|
||||
{
|
||||
AdjustTrackEvent.Instance.TrackAdEvent(type == AdsType.Rewarded ? _rewardAdRevenue : _interstitiaAdRevenue,
|
||||
ClientName,
|
||||
type == AdsType.Rewarded ? _rewardAdUnitId : _interstitialAdUnitId,
|
||||
type == AdsType.Rewarded ? _rewardAdUnitId : _interstitialAdUnitId);
|
||||
adUnitId,
|
||||
adUnitId);
|
||||
|
||||
FireBaseAnalyticsManager.Instance.OnAdRevenueEvent(ClientName,
|
||||
ClientName,
|
||||
type == AdsType.Rewarded ? _rewardAdUnitId : _interstitialAdUnitId,
|
||||
adUnitId,
|
||||
type,
|
||||
type == AdsType.Rewarded ? _rewardAdRevenue : _interstitiaAdRevenue,
|
||||
type == AdsType.Rewarded ? _rvPos : _ivPos,
|
||||
|
@ -261,7 +261,7 @@ namespace WZ
|
|||
|
||||
ShuShuEvent.Instance.OnAdRevenueEvent(ClientName,
|
||||
ClientName,
|
||||
type == AdsType.Rewarded ? _rewardAdUnitId : _interstitialAdUnitId,
|
||||
adUnitId,
|
||||
type.ToString(),
|
||||
type == AdsType.Rewarded ? _rewardAdRevenue : _interstitiaAdRevenue,
|
||||
type == AdsType.Rewarded ? _rvPos : _ivPos,
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace WZ
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!hasPendingRequests)
|
||||
{
|
||||
// 所有楼层都请求完毕,并且没有正在处理的请求,确实没有填充
|
||||
|
@ -119,7 +119,7 @@ namespace WZ
|
|||
{
|
||||
RequestFloorAd(floor);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void RequestFloorAd(FloorConfig floor)
|
||||
|
@ -156,7 +156,7 @@ namespace WZ
|
|||
}
|
||||
|
||||
// 处理楼层广告加载成功
|
||||
public void OnFloorAdLoaded(FloorConfig floor, IInterstitialAdController controller,double revenue)
|
||||
public void OnFloorAdLoaded(FloorConfig floor, IInterstitialAdController controller, double revenue)
|
||||
{
|
||||
if (!_isRequestingFloors || _successfulFloor != null) return;
|
||||
|
||||
|
@ -190,15 +190,15 @@ namespace WZ
|
|||
// 处理楼层广告加载失败
|
||||
public void OnFloorAdFailed(FloorConfig floor, string error)
|
||||
{
|
||||
LoggerUtils.Debug($"[kwai] floor inter ad failed: {floor.id} with error: {error} _isRequestingFloors:{!_isRequestingFloors} _successfulFloor: {_successfulFloor != null}" );
|
||||
LoggerUtils.Debug($"[kwai] floor inter ad failed: {floor.id} with error: {error} _isRequestingFloors:{!_isRequestingFloors} _successfulFloor: {_successfulFloor != null}");
|
||||
if (!_isRequestingFloors || _successfulFloor != null) return;
|
||||
|
||||
// 移除失败floor
|
||||
if(_currentRequestBatch.Contains(floor))_currentRequestBatch.Remove(floor);
|
||||
|
||||
if (_currentRequestBatch.Contains(floor)) _currentRequestBatch.Remove(floor);
|
||||
|
||||
// 检查当前批次是否全部失败
|
||||
bool allFailedInBatch = true;
|
||||
if (_currentRequestBatch.Count > 0) allFailedInBatch = false;
|
||||
if (_currentRequestBatch.Count > 0) allFailedInBatch = false;
|
||||
|
||||
// 如果当前批次全部失败,请求下一批
|
||||
if (allFailedInBatch)
|
||||
|
@ -267,7 +267,7 @@ namespace WZ
|
|||
{
|
||||
return _currentRequestId;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成唯一的Request ID
|
||||
/// </summary>
|
||||
|
@ -275,6 +275,11 @@ namespace WZ
|
|||
{
|
||||
return Guid.NewGuid().ToString("N");
|
||||
}
|
||||
|
||||
public string GetSuccessfulFloorUnitId()
|
||||
{
|
||||
return _successfulFloor != null ? _successfulFloor.unite_id : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace WZ
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!hasPendingRequests)
|
||||
{
|
||||
// 所有楼层都请求完毕,并且没有正在处理的请求,确实没有填充
|
||||
|
@ -153,7 +153,7 @@ namespace WZ
|
|||
}
|
||||
|
||||
// 处理楼层广告加载成功
|
||||
public void OnFloorAdLoaded(FloorConfig floor, IRewardAdController controller,double revenue)
|
||||
public void OnFloorAdLoaded(FloorConfig floor, IRewardAdController controller, double revenue)
|
||||
{
|
||||
if (!_isRequestingFloors || _successfulFloor != null) return;
|
||||
|
||||
|
@ -186,15 +186,15 @@ namespace WZ
|
|||
// 处理楼层广告加载失败
|
||||
public void OnFloorAdFailed(FloorConfig floor, string error)
|
||||
{
|
||||
LoggerUtils.Debug($"[kwai] floor reward ad failed: {floor.id} with error: {error} _isRequestingFloors:{!_isRequestingFloors} _successfulFloor: {_successfulFloor != null}" );
|
||||
LoggerUtils.Debug($"[kwai] floor reward ad failed: {floor.id} with error: {error} _isRequestingFloors:{!_isRequestingFloors} _successfulFloor: {_successfulFloor != null}");
|
||||
if (!_isRequestingFloors || _successfulFloor != null) return;
|
||||
|
||||
// 移除失败floor
|
||||
if(_currentRequestBatch.Contains(floor))_currentRequestBatch.Remove(floor);
|
||||
|
||||
if (_currentRequestBatch.Contains(floor)) _currentRequestBatch.Remove(floor);
|
||||
|
||||
// 检查当前批次是否全部失败
|
||||
bool allFailedInBatch = true;
|
||||
if (_currentRequestBatch.Count > 0) allFailedInBatch = false;
|
||||
if (_currentRequestBatch.Count > 0) allFailedInBatch = false;
|
||||
|
||||
// 如果当前批次全部失败,请求下一批
|
||||
if (allFailedInBatch)
|
||||
|
@ -263,7 +263,7 @@ namespace WZ
|
|||
{
|
||||
return _currentRequestId;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成唯一的Request ID
|
||||
/// </summary>
|
||||
|
@ -271,6 +271,11 @@ namespace WZ
|
|||
{
|
||||
return Guid.NewGuid().ToString("N");
|
||||
}
|
||||
|
||||
public string GetSuccessfulFloorUnitId()
|
||||
{
|
||||
return _successfulFloor != null ? _successfulFloor.unite_id : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace WZ
|
|||
{
|
||||
AdsActionEvents.TrackAdClicked(KwaiAdsManager.Instance.Platfrom,
|
||||
KwaiAdsManager.Instance.ClientName,
|
||||
KwaiAdsManager.Instance._interstitialAdUnitId,
|
||||
KwaiFloorIvManager.Instance.GetSuccessfulFloorUnitId(),
|
||||
AdsType.Interstitial,
|
||||
KwaiAdsManager.Instance._ivPos,
|
||||
KwaiAdsManager.Instance._interstitiaAdRevenue);
|
||||
|
@ -33,7 +33,7 @@ namespace WZ
|
|||
{
|
||||
AdsActionEvents.TrackAdClosed(KwaiAdsManager.Instance.Platfrom,
|
||||
KwaiAdsManager.Instance.ClientName,
|
||||
KwaiAdsManager.Instance._interstitialAdUnitId,
|
||||
KwaiFloorIvManager.Instance.GetSuccessfulFloorUnitId(),
|
||||
AdsType.Interstitial,
|
||||
KwaiAdsManager.Instance._ivPos,
|
||||
KwaiAdsManager.Instance._interstitiaAdRevenue);
|
||||
|
@ -50,7 +50,7 @@ namespace WZ
|
|||
|
||||
public void OnAdShow()
|
||||
{
|
||||
KwaiAdsManager.Instance.TrackAdImpression(AdsType.Interstitial);
|
||||
KwaiAdsManager.Instance.TrackAdImpression(AdsType.Interstitial,KwaiFloorIvManager.Instance.GetSuccessfulFloorUnitId());
|
||||
LoggerUtils.Debug("[kwai] floor inter OnAdShow");
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace WZ
|
|||
public void OnAdShow()
|
||||
{
|
||||
// 插页视频曝光 | Interstitial video show
|
||||
KwaiAdsManager.Instance.TrackAdImpression(AdsType.Interstitial);
|
||||
KwaiAdsManager.Instance.TrackAdImpression(AdsType.Interstitial,KwaiAdsManager.Instance._interstitialAdUnitId);
|
||||
LoggerUtils.Debug("[kwai] InterstitialAdListener#OnAdShow");
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace WZ
|
|||
{
|
||||
AdsActionEvents.TrackAdClicked(KwaiAdsManager.Instance.Platfrom,
|
||||
KwaiAdsManager.Instance.ClientName,
|
||||
KwaiAdsManager.Instance._rewardAdUnitId,
|
||||
KwaiFloorRvManager.Instance.GetSuccessfulFloorUnitId(),
|
||||
AdsType.Rewarded,
|
||||
KwaiAdsManager.Instance._rvPos,
|
||||
KwaiAdsManager.Instance._rewardAdRevenue);
|
||||
|
@ -34,7 +34,7 @@ namespace WZ
|
|||
{
|
||||
AdsActionEvents.TrackAdClosed(KwaiAdsManager.Instance.Platfrom,
|
||||
KwaiAdsManager.Instance.ClientName,
|
||||
KwaiAdsManager.Instance._rewardAdUnitId,
|
||||
KwaiFloorRvManager.Instance.GetSuccessfulFloorUnitId(),
|
||||
AdsType.Rewarded,
|
||||
KwaiAdsManager.Instance._rvPos,
|
||||
KwaiAdsManager.Instance._rewardAdRevenue);
|
||||
|
@ -53,7 +53,7 @@ namespace WZ
|
|||
|
||||
public void OnAdShow()
|
||||
{
|
||||
KwaiAdsManager.Instance.TrackAdImpression(AdsType.Rewarded);
|
||||
KwaiAdsManager.Instance.TrackAdImpression(AdsType.Rewarded,KwaiFloorRvManager.Instance.GetSuccessfulFloorUnitId());
|
||||
LoggerUtils.Debug("[kwai] floor reward RewardAdListener#OnAdShow");
|
||||
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ namespace WZ
|
|||
public void OnAdClose()
|
||||
{
|
||||
AdsActionEvents.TrackAdClosed(KwaiAdsManager.Instance.Platfrom,
|
||||
KwaiAdsManager.Instance.ClientName,
|
||||
KwaiAdsManager.Instance._rewardAdUnitId,
|
||||
AdsType.Rewarded,
|
||||
KwaiAdsManager.Instance._rvPos,
|
||||
KwaiAdsManager.Instance._rewardAdRevenue);
|
||||
KwaiAdsManager.Instance.ClientName,
|
||||
KwaiAdsManager.Instance._rewardAdUnitId,
|
||||
AdsType.Rewarded,
|
||||
KwaiAdsManager.Instance._rvPos,
|
||||
KwaiAdsManager.Instance._rewardAdRevenue);
|
||||
KwaiAdsManager.Instance._rvCloseCallback?.Invoke(KwaiAdsManager.Instance._receivedReward, KwaiAdsManager.Instance._rewardAdRevenue);
|
||||
KwaiAdsManager.Instance._rvCloseCallback = null;
|
||||
KwaiAdsManager.Instance._receivedReward = false;
|
||||
|
@ -41,7 +41,7 @@ namespace WZ
|
|||
public void OnAdShow()
|
||||
{
|
||||
// 激励视频曝光 | Reward video show
|
||||
KwaiAdsManager.Instance.TrackAdImpression(AdsType.Rewarded);
|
||||
KwaiAdsManager.Instance.TrackAdImpression(AdsType.Rewarded,KwaiAdsManager.Instance._rewardAdUnitId);
|
||||
LoggerUtils.Debug("[kwai] RewardAdListener#OnAdShow");
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||
using AnyThinkAds.Api;
|
||||
using GoogleMobileAds.Api;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Purchasing;
|
||||
using WZ;
|
||||
|
||||
public class Test : MonoBehaviour
|
||||
|
@ -17,6 +18,18 @@ public class Test : MonoBehaviour
|
|||
{
|
||||
small = gameObject.transform.Find("NativeAd-small").GetComponent<RectTransform>();
|
||||
medium = gameObject.transform.Find("NativeAd-medium").GetComponent<RectTransform>();
|
||||
RushSDKManager.Instance.RegisterPurchaseCompletionHandler((info)=>
|
||||
{
|
||||
LoggerUtils.Debug("[iap] result ->" + info.ToJson());
|
||||
if (info.purchaseResult == true || info.orderAlreadyExists == true)
|
||||
{
|
||||
RushSDKManager.Instance.LogCheckingOrder(info.productName,info.productID,info.orderID,info.gameExtra,info.gameExtra);
|
||||
}
|
||||
});
|
||||
RushSDKManager.Instance.AddProductsStatic(new Dictionary<string, UnityEngine.Purchasing.ProductType>()
|
||||
{
|
||||
{ "com.tilematch.1000gold", ProductType.Consumable }
|
||||
});
|
||||
RushSDKManager.Instance.SetUserSourceListener((bool success, string source) =>
|
||||
{
|
||||
LoggerUtils.Debug("adjust callback: "+success+" adnetwork:"+source);
|
||||
|
@ -34,7 +47,8 @@ public class Test : MonoBehaviour
|
|||
// {
|
||||
// LoggerUtils.Debug("[kwai] OnRewardedVideoAdShowed revenue:"+revenue+"+ state:"+state);
|
||||
// });
|
||||
RushSDKManager.Instance.ShowBanner(BannerType.Standard,BannerAlignType.CenterTop);
|
||||
// RushSDKManager.Instance.ShowBanner(BannerType.Standard,BannerAlignType.CenterTop);
|
||||
RushSDKManager.Instance.PurchaseProductById("com.tilematch.1000gold","1000gold");
|
||||
}
|
||||
|
||||
public void OnShowInterstitial()
|
||||
|
|
Loading…
Reference in New Issue