diff --git a/Assets/Script/SDKManager/AdsSDKManager/Events/AdsEvents/AdsActionEvents.cs b/Assets/Script/SDKManager/AdsSDKManager/Events/AdsEvents/AdsActionEvents.cs index 1816c57..7633f1d 100644 --- a/Assets/Script/SDKManager/AdsSDKManager/Events/AdsEvents/AdsActionEvents.cs +++ b/Assets/Script/SDKManager/AdsSDKManager/Events/AdsEvents/AdsActionEvents.cs @@ -44,7 +44,7 @@ namespace WZ } public static void TrackKwiWaterfallFill(AdsType adsType, string requestId, string unitId, - float floorPrice, int waterfallRequestNumber, int unitRequestNumber, int floorNumber,float value) + float floorPrice, int waterfallRequestNumber, int unitRequestNumber, int floorNumber,double value) { var eventName = "kwai_waterfall_fill"; var dic = new Dictionary { diff --git a/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/KwaiFloorIvManager.cs b/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/KwaiFloorIvManager.cs index 5e266ee..ceaee85 100644 --- a/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/KwaiFloorIvManager.cs +++ b/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/KwaiFloorIvManager.cs @@ -24,7 +24,7 @@ namespace WZ private FloorConfig _successfulFloor = null; public float _ivStartLoadTime = 0; private int _waterfallRequestCount = 0; // waterfall请求次数 - private Dictionary _uniteIdRequestCounts = new Dictionary(); // 每个unite_id的请求次数 + private Dictionary _unitIdRequestCounts = new Dictionary(); // 每个unite_id的请求次数 private string _currentRequestId; // 当前waterfall请求的ID @@ -55,6 +55,7 @@ namespace WZ _currentFloorIndex = 0; _successfulFloor = null; _isRequestingFloors = true; + _currentRequestId = GenerateRequestId(); // 增加waterfall请求计数 _waterfallRequestCount++; @@ -100,21 +101,24 @@ namespace WZ { RequestFloorAd(floor); } + AdsActionEvents.TrackKwaiWaterfallRequest(AdsType.Interstitial, + _currentRequestId, + _waterfallRequestCount, + _ivParallelRequests); } private void RequestFloorAd(FloorConfig floor) { // 更新unite_id请求计数 - if (!_uniteIdRequestCounts.ContainsKey(floor.unite_id)) + if (!_unitIdRequestCounts.ContainsKey(floor.unite_id)) { - _uniteIdRequestCounts[floor.unite_id] = 0; + _unitIdRequestCounts[floor.unite_id] = 0; } - _uniteIdRequestCounts[floor.unite_id]++; + _unitIdRequestCounts[floor.unite_id]++; // 获取当前楼层在排序列表中的位置 int floorIndex = GetFloorIndex(floor.id); - _currentRequestId = GenerateRequestId(); - LoggerUtils.Debug($"[kwai] floor inter Requesting floor {floor.id} (index: {floorIndex}), unite_id {floor.unite_id} has been requested {_uniteIdRequestCounts[floor.unite_id]} times, request id: {_currentRequestId}"); + LoggerUtils.Debug($"[kwai] floor inter Requesting floor {floor.id} (index: {floorIndex}), unite_id {floor.unite_id} has been requested {_unitIdRequestCounts[floor.unite_id]} times, request id: {GetUniteIdRequestCount(floor.unite_id)}"); IInterstitialAdController controller = KwaiAds.Scripts.Api.KwaiAdsSdk.SDK.getInterstitialAdController(); ; _ivFloorAdControllers[floor.id] = controller; @@ -125,16 +129,25 @@ namespace WZ controller.Load(kwaiInterstitialAdRequest, new FloorInterAdListener(this, floor), new FloorInterAdLoadListener(this, floor)); + + AdsActionEvents.TrackKwaiAdunitRequest(AdsType.Interstitial, + _currentRequestId, + floor.unite_id, + floor.price, + GetWaterfallRequestCount(), + GetUniteIdRequestCount(floor.unite_id), + floorIndex); + } // 处理楼层广告加载成功 - public void OnFloorAdLoaded(FloorConfig floor, IInterstitialAdController controller) + public void OnFloorAdLoaded(FloorConfig floor, IInterstitialAdController controller,double revenue) { if (!_isRequestingFloors || _successfulFloor != null) return; // 获取当前楼层在排序列表中的位置 int floorIndex = GetFloorIndex(floor.id); - LoggerUtils.Debug($"[kwai] floor reward Floor ad loaded: {floor.id} (index: {floorIndex}) with price: {floor.price}, unite_id {floor.unite_id} has been requested {_uniteIdRequestCounts[floor.unite_id]} times"); + LoggerUtils.Debug($"[kwai] floor inter ad loaded: {floor.id} (index: {floorIndex}) with price: {floor.price}, unite_id {floor.unite_id} has been requested {GetUniteIdRequestCount(floor.unite_id)} times, revenue: {revenue}, request id: {_currentRequestId}"); // 暂停其他并行请求 @@ -149,6 +162,14 @@ namespace WZ kvp.Value.Destroy(); } } + AdsActionEvents.TrackKwiWaterfallFill(AdsType.Interstitial, + _currentRequestId, + floor.unite_id, + floor.price, + GetWaterfallRequestCount(), + GetUniteIdRequestCount(floor.unite_id), + floorIndex, + revenue); } // 处理楼层广告加载失败 @@ -215,7 +236,7 @@ namespace WZ /// public int GetUniteIdRequestCount(string unitId) { - return _uniteIdRequestCounts.TryGetValue(unitId, out var time) ? time : 0; + return _unitIdRequestCounts.TryGetValue(unitId, out var time) ? time : 0; } /// diff --git a/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/KwaiFloorRvManager.cs b/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/KwaiFloorRvManager.cs index c72dfcc..1f58ce2 100644 --- a/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/KwaiFloorRvManager.cs +++ b/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/KwaiFloorRvManager.cs @@ -22,7 +22,7 @@ namespace WZ private FloorConfig _successfulFloor = null; public float _rvStartLoadTime = 0; private int _waterfallRequestCount = 0; // waterfall请求次数 - private Dictionary _uniteIdRequestCounts = new Dictionary(); // 每个unite_id的请求次数 + private Dictionary _unitIdRequestCounts = new Dictionary(); // 每个unite_id的请求次数 private string _currentRequestId; // 当前waterfall请求的ID public void InitializeWithFloors() @@ -54,7 +54,7 @@ namespace WZ _currentFloorIndex = 0; _successfulFloor = null; _isRequestingFloors = true; - + _currentRequestId = GenerateRequestId(); // 增加waterfall请求计数 _waterfallRequestCount++; @@ -67,6 +67,8 @@ namespace WZ // 开始请求楼层广告 RequestNextFloorBatch(); + + AdsActionEvents.TrackKwaiWaterfallRequest(AdsType.Rewarded, _currentRequestId, _waterfallRequestCount, _rvParallelRequests); } private void RequestNextFloorBatch() @@ -104,16 +106,16 @@ namespace WZ private void RequestFloorAd(FloorConfig floor) { // 更新unite_id请求计数 - if (!_uniteIdRequestCounts.ContainsKey(floor.unite_id)) + if (!_unitIdRequestCounts.ContainsKey(floor.unite_id)) { - _uniteIdRequestCounts[floor.unite_id] = 0; + _unitIdRequestCounts[floor.unite_id] = 0; } - _uniteIdRequestCounts[floor.unite_id]++; + _unitIdRequestCounts[floor.unite_id]++; // 获取当前楼层在排序列表中的位置 int floorIndex = GetFloorIndex(floor.id); - _currentRequestId = GenerateRequestId(); - LoggerUtils.Debug($"[kwai] floor reward Requesting floor {floor.id} (index: {floorIndex}), unite_id {floor.unite_id} has been requested {_uniteIdRequestCounts[floor.unite_id]} times, request id: {_currentRequestId}"); + + LoggerUtils.Debug($"[kwai] floor reward Requesting floor {floor.id} (index: {floorIndex}), unite_id {floor.unite_id} has been requested {GetUniteIdRequestCount(floor.unite_id)} times, request id: {_currentRequestId}"); IRewardAdController controller = KwaiAds.Scripts.Api.KwaiAdsSdk.SDK.getRewardAdController(); _rvFloorAdControllers[floor.id] = controller; @@ -124,16 +126,24 @@ namespace WZ controller.Load(kwaiRewardAdRequest, new FloorRewardAdListener(this, floor), new FloorRewardAdLoadListener(this, floor)); + + AdsActionEvents.TrackKwaiAdunitRequest(AdsType.Rewarded, + _currentRequestId, + floor.unite_id, + floor.price, + GetWaterfallRequestCount(), + GetUniteIdRequestCount(floor.unite_id), + floorIndex); } // 处理楼层广告加载成功 - public void OnFloorAdLoaded(FloorConfig floor, IRewardAdController controller) + public void OnFloorAdLoaded(FloorConfig floor, IRewardAdController controller,double revenue) { if (!_isRequestingFloors || _successfulFloor != null) return; // 获取当前楼层在排序列表中的位置 int floorIndex = GetFloorIndex(floor.id); - LoggerUtils.Debug($"[kwai] floor reward Floor ad loaded: {floor.id} (index: {floorIndex}) with price: {floor.price}, unite_id {floor.unite_id} has been requested {_uniteIdRequestCounts[floor.unite_id]} times"); + LoggerUtils.Debug($"[kwai] floor reward Floor ad loaded: {floor.id} (index: {floorIndex}) with floor price: {floor.price}, unite_id {floor.unite_id} has been requested {GetUniteIdRequestCount(floor.unite_id)} times, revenue:{revenue}"); // 暂停其他并行请求 _successfulFloor = floor; @@ -147,6 +157,14 @@ namespace WZ kvp.Value.Destroy(); } } + AdsActionEvents.TrackKwiWaterfallFill(AdsType.Rewarded, + _currentRequestId, + floor.unite_id, + floor.price, + GetWaterfallRequestCount(), + GetUniteIdRequestCount(floor.unite_id), + floorIndex, + revenue); } // 处理楼层广告加载失败 @@ -213,7 +231,7 @@ namespace WZ /// public int GetUniteIdRequestCount(string unitId) { - return _uniteIdRequestCounts.TryGetValue(unitId, out var time) ? time : 0; + return _unitIdRequestCounts.TryGetValue(unitId, out var time) ? time : 0; } /// diff --git a/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/Listener/Inter/Floor/FloorInterAdLoadListener.cs b/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/Listener/Inter/Floor/FloorInterAdLoadListener.cs index a96d193..a5300f1 100644 --- a/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/Listener/Inter/Floor/FloorInterAdLoadListener.cs +++ b/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/Listener/Inter/Floor/FloorInterAdLoadListener.cs @@ -43,7 +43,7 @@ namespace WZ trackId, AdsType.Interstitial, Time.realtimeSinceStartup - KwaiFloorIvManager.Instance._ivStartLoadTime); - _manager.OnFloorAdLoaded(_floor, _manager._ivFloorAdControllers[_floor.id]); + _manager.OnFloorAdLoaded(_floor, _manager._ivFloorAdControllers[_floor.id],KwaiAdsManager.Instance._interstitiaAdRevenue); LoggerUtils.Debug("[kwai] floor inter ad load success: "+trackId+" with price: "+price); } } diff --git a/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/Listener/Reward/Floor/FloorRewardAdLoadListener.cs b/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/Listener/Reward/Floor/FloorRewardAdLoadListener.cs index 6ee24ee..347bb1e 100644 --- a/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/Listener/Reward/Floor/FloorRewardAdLoadListener.cs +++ b/Assets/Script/SDKManager/AdsSDKManager/KwaiAdsManager/Listener/Reward/Floor/FloorRewardAdLoadListener.cs @@ -41,7 +41,7 @@ namespace WZ trackId, AdsType.Rewarded, Time.realtimeSinceStartup - KwaiFloorRvManager.Instance._rvStartLoadTime); - _manager.OnFloorAdLoaded(_floor, _manager._rvFloorAdControllers[_floor.id]); + _manager.OnFloorAdLoaded(_floor, _manager._rvFloorAdControllers[_floor.id], KwaiAdsManager.Instance._rewardAdRevenue); LoggerUtils.Debug("[kwai] floor reward ad load success: "+trackId+" with price: "+price); } }