修复事件打点
This commit is contained in:
parent
87de004f3d
commit
695b30a083
|
@ -404,7 +404,7 @@ namespace WZ
|
|||
type,
|
||||
adValue.Value / 1000000f,
|
||||
type == AdsType.Rewarded ? _rvPos : "",
|
||||
AdPlayCountManager.GetAdPlayCount(type));
|
||||
AdPlayCountManager.GetAdsActionCount(type, AdPlayCountManager.PLAY_COUNT_SUFFIX));
|
||||
|
||||
ShuShuEvent.Instance.OnAdRevenueEvent(PlatformType.Admob.ToString(),
|
||||
loadedAdapterResponseInfo.AdSourceName,
|
||||
|
@ -412,7 +412,7 @@ namespace WZ
|
|||
type.ToString(),
|
||||
adValue.Value / 1000000f,
|
||||
type == AdsType.Rewarded ? _rvPos : "",
|
||||
AdPlayCountManager.GetAdPlayCount(type));
|
||||
AdPlayCountManager.GetAdsActionCount(type, AdPlayCountManager.PLAY_COUNT_SUFFIX));
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -67,7 +67,8 @@ namespace WZ
|
|||
adSource,
|
||||
adUnitId,
|
||||
AdsType.Native,
|
||||
Time.realtimeSinceStartup - _adStartLoadTimes[adUnitId], reason);
|
||||
Time.realtimeSinceStartup - _adStartLoadTimes[adUnitId],
|
||||
reason);
|
||||
|
||||
var retryDelay = Math.Pow(2, Math.Min(6, _retryCounters[adUnitId]));
|
||||
TimerUtils.Instance.DelayExecute((float)retryDelay, () => { LoadAd(adUnitId); });
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace WZ
|
|||
{
|
||||
_showFailedCallback?.Invoke();
|
||||
}
|
||||
AdPlayCountManager.IncrementAdPlayCount(AdsType.Rewarded);
|
||||
AdPlayCountManager.IncrementAdsActionCount(AdsType.Rewarded,AdPlayCountManager.PLAY_COUNT_SUFFIX);
|
||||
AdjustTrackEvent.Instance.TrackEventName("RV_Show", new Dictionary<string, object>());
|
||||
CheckAndRefreshExpiredBids(AdsType.Rewarded);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ namespace WZ
|
|||
_closeCallback?.Invoke(0);
|
||||
}
|
||||
|
||||
AdPlayCountManager.IncrementAdPlayCount(AdsType.Interstitial);
|
||||
AdPlayCountManager.IncrementAdsActionCount(AdsType.Interstitial,AdPlayCountManager.PLAY_COUNT_SUFFIX);
|
||||
AdjustTrackEvent.Instance.TrackEventName("IV_Show", new Dictionary<string, object>());
|
||||
// 刷新其他类型广告
|
||||
CheckAndRefreshExpiredBids(AdsType.Interstitial);
|
||||
|
@ -159,7 +159,7 @@ namespace WZ
|
|||
{
|
||||
|
||||
AdmobAdsManager.Instance.DisplayBanner();
|
||||
AdPlayCountManager.IncrementAdPlayCount(AdsType.Banner);
|
||||
AdPlayCountManager.IncrementAdsActionCount(AdsType.Banner,AdPlayCountManager.PLAY_COUNT_SUFFIX);
|
||||
AdjustTrackEvent.Instance.TrackEventName("Banner_Show", new Dictionary<string, object>());
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ namespace WZ
|
|||
|
||||
AdmobAdsManager.Instance.DisplayNative(_adPos, adUnitId, position);
|
||||
AdjustTrackEvent.Instance.TrackEventName("NA_Show", new Dictionary<string, object>());
|
||||
AdPlayCountManager.IncrementAdPlayCount(AdsType.Native);
|
||||
AdPlayCountManager.IncrementAdsActionCount(AdsType.Native,AdPlayCountManager.PLAY_COUNT_SUFFIX);
|
||||
}
|
||||
|
||||
public void RemoveNativeAd(string adUnitId)
|
||||
|
@ -199,7 +199,7 @@ namespace WZ
|
|||
public void ShowSplashAd()
|
||||
{
|
||||
AdjustTrackEvent.Instance.TrackEventName("SP_Show", new Dictionary<string, object>());
|
||||
AdPlayCountManager.IncrementAdPlayCount(AdsType.Splash);
|
||||
AdPlayCountManager.IncrementAdsActionCount(AdsType.Splash,AdPlayCountManager.PLAY_COUNT_SUFFIX);
|
||||
AdmobAdsManager.Instance.DisplaySplash();
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace WZ
|
|||
{
|
||||
return;
|
||||
}
|
||||
AdsActionEvents.TrackAdPosition(AdsType.Splash,"");
|
||||
Invoke(nameof(TrackAdImpression), 10);
|
||||
if (!AdsSDKManager.Instance.IsSplashAvailable())
|
||||
{
|
||||
LoggerUtils.Debug(" [AppOpen] 热启动 广告是否准备好:");
|
||||
|
@ -97,7 +97,7 @@ namespace WZ
|
|||
{
|
||||
// 冷启动
|
||||
// 首次启动
|
||||
AdsActionEvents.TrackAdPosition(AdsType.Splash,"");
|
||||
Invoke(nameof(TrackAdImpression), 10);
|
||||
var isNew = PlayerPrefsUtils.GetPlayerPrefsInt("Firstcold_Splash_Switch", 0) == 0;
|
||||
// 首次冷启动开关
|
||||
var isFirstShow = GetSplashConfigItem().firstcold_splash_switch == 1;
|
||||
|
@ -152,6 +152,11 @@ namespace WZ
|
|||
}
|
||||
}
|
||||
|
||||
private void TrackAdImpression()
|
||||
{
|
||||
AdsActionEvents.TrackAdPosition(AdsType.Splash,"");
|
||||
}
|
||||
|
||||
private static string Splash_AD_RULES = "Splash_AD_RULES";
|
||||
private static string Splash_AD_RULES_DEFAULT_VALUE = "[{\"firstcold_splash_switch\":1,\"cold_splash_switch\":1,\"hot_splash_switch\":1,\"hot_timegap\":30,\"loadtime\":5}]";
|
||||
|
||||
|
|
|
@ -269,14 +269,14 @@ namespace WZ
|
|||
placement,
|
||||
type,
|
||||
revenue, type == AdsType.Rewarded ? _rvPos : "",
|
||||
AdPlayCountManager.GetAdPlayCount(type));
|
||||
AdPlayCountManager.GetAdsActionCount(type,AdPlayCountManager.PLAY_COUNT_SUFFIX));
|
||||
|
||||
ShuShuEvent.Instance.OnAdRevenueEvent(ClientName,
|
||||
ClientName,
|
||||
placement,
|
||||
type.ToString(),
|
||||
revenue, type == AdsType.Rewarded ? _rvPos : "",
|
||||
AdPlayCountManager.GetAdPlayCount(type));
|
||||
AdPlayCountManager.GetAdsActionCount(type,AdPlayCountManager.PLAY_COUNT_SUFFIX));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using AnyThinkAds.ThirdParty.LitJson;
|
||||
|
@ -11,6 +12,7 @@ namespace WZ
|
|||
{
|
||||
public static void TrackAdClicked(PlatformType adPlatform, string adSource, string adUnitName, AdsType adFormat, string posotion, double value)
|
||||
{
|
||||
AdPlayCountManager.IncrementAdsActionCount(adFormat, AdPlayCountManager.CLICK_COUNT_SUFFIX);
|
||||
var eventName = "ad_click";
|
||||
var dic = new Dictionary<string, object> {
|
||||
{ "ad_platform", adPlatform.ToString()},
|
||||
|
@ -20,7 +22,7 @@ namespace WZ
|
|||
{ "position", posotion},
|
||||
{ "value", value},
|
||||
{ "currency","USD"},
|
||||
{ "number",AdPlayCountManager.GetAdPlayCount(adFormat)}
|
||||
{ "number",AdPlayCountManager.GetAdsActionCount(adFormat,AdPlayCountManager.CLICK_COUNT_SUFFIX)}
|
||||
};
|
||||
FireBaseAnalyticsManager.Instance.LogEvent(eventName, dic);
|
||||
ShuShuEvent.Instance.Track(eventName, dic);
|
||||
|
@ -30,6 +32,7 @@ namespace WZ
|
|||
public static void TrackAdClosed(PlatformType adPlatform, string adSource, string adUnitName, AdsType adFormat, string posotion, double value)
|
||||
{
|
||||
AdsSDKManager.Instance.otherAdsOnShow = false;
|
||||
AdPlayCountManager.IncrementAdsActionCount(adFormat, AdPlayCountManager.CLOSE_COUNT_SUFFIX);
|
||||
var eventName = "ad_close";
|
||||
var dic = new Dictionary<string, object> {
|
||||
{ "ad_platform", adPlatform.ToString()},
|
||||
|
@ -39,7 +42,7 @@ namespace WZ
|
|||
{ "position", posotion},
|
||||
{ "value", value},
|
||||
{ "currency","USD"},
|
||||
{ "number",AdPlayCountManager.GetAdPlayCount(adFormat)}
|
||||
{ "number",AdPlayCountManager.GetAdsActionCount(adFormat,AdPlayCountManager.CLOSE_COUNT_SUFFIX)}
|
||||
};
|
||||
FireBaseAnalyticsManager.Instance.LogEvent(eventName, dic);
|
||||
ShuShuEvent.Instance.Track(eventName, dic);
|
||||
|
@ -48,11 +51,12 @@ namespace WZ
|
|||
|
||||
public static void TrackAdStartLoad(PlatformType adPlatform, string adSource, string adUnitName, AdsType adFormat)
|
||||
{
|
||||
AdPlayCountManager.IncrementAdsActionCount(adFormat, AdPlayCountManager.STARTLOAD_COUNT_SUFFIX);
|
||||
var eventName = "ad_start_load";
|
||||
var dic = new Dictionary<string, object> {
|
||||
{ "ad_platform", adPlatform.ToString()},
|
||||
{ "ad_format", adFormat.ToString()},
|
||||
{ "number",AdPlayCountManager.GetAdPlayCount(adFormat)}
|
||||
{ "number",AdPlayCountManager.GetAdsActionCount(adFormat,AdPlayCountManager.STARTLOAD_COUNT_SUFFIX)}
|
||||
};
|
||||
FireBaseAnalyticsManager.Instance.LogEvent(eventName, dic);
|
||||
ShuShuEvent.Instance.Track(eventName, dic);
|
||||
|
@ -61,14 +65,15 @@ namespace WZ
|
|||
|
||||
public static void TrackAdLoaded(PlatformType adPlatform, string adSource, string adUnitName, AdsType adFormat, double loadTime)
|
||||
{
|
||||
AdPlayCountManager.IncrementAdsActionCount(adFormat, AdPlayCountManager.LOADED_COUNT_SUFFIX);
|
||||
var eventName = "ad_loaded";
|
||||
var dic = new Dictionary<string, object> {
|
||||
{ "ad_platform", adPlatform.ToString()},
|
||||
{ "ad_source", adSource},
|
||||
{ "ad_unit_name", adUnitName},
|
||||
{ "ad_format", adFormat.ToString()},
|
||||
{ "pass_time", loadTime},
|
||||
{ "number",AdPlayCountManager.GetAdPlayCount(adFormat)}
|
||||
{ "pass_time", (int)Math.Ceiling(loadTime)},
|
||||
{ "number",AdPlayCountManager.GetAdsActionCount(adFormat,AdPlayCountManager.LOADED_COUNT_SUFFIX)}
|
||||
};
|
||||
FireBaseAnalyticsManager.Instance.LogEvent(eventName, dic);
|
||||
ShuShuEvent.Instance.Track(eventName, dic);
|
||||
|
@ -76,15 +81,16 @@ namespace WZ
|
|||
}
|
||||
public static void TrackAdFailToLoad(PlatformType adPlatform, string adSource, string adUnitName, AdsType adFormat, double loadTime, string reason)
|
||||
{
|
||||
AdPlayCountManager.IncrementAdsActionCount(adFormat, AdPlayCountManager.LOADFAIL_COUNT_SUFFIX);
|
||||
var eventName = "ad_load_fail";
|
||||
var dic = new Dictionary<string, object> {
|
||||
{ "ad_platform", adPlatform.ToString()},
|
||||
{ "ad_source", adSource},
|
||||
{ "ad_unit_name", adUnitName},
|
||||
{ "ad_format", adFormat.ToString()},
|
||||
{ "pass_time", loadTime},
|
||||
{ "pass_time", (int)Math.Ceiling(loadTime)},
|
||||
{ "reason", reason},
|
||||
{ "number",AdPlayCountManager.GetAdPlayCount(adFormat)}
|
||||
{ "number",AdPlayCountManager.GetAdsActionCount(adFormat,AdPlayCountManager.LOADFAIL_COUNT_SUFFIX)}
|
||||
};
|
||||
FireBaseAnalyticsManager.Instance.LogEvent(eventName, dic);
|
||||
ShuShuEvent.Instance.Track(eventName, dic);
|
||||
|
@ -93,6 +99,7 @@ namespace WZ
|
|||
|
||||
public static void TrackAdFailToShow(PlatformType adPlatform, AdsType adFormat, string reason, string pos)
|
||||
{
|
||||
AdPlayCountManager.IncrementAdsActionCount(adFormat, AdPlayCountManager.SHOWFAIL_COUNT_SUFFIX);
|
||||
AdsSDKManager.Instance.otherAdsOnShow = false;
|
||||
var eventName = "ad_show_fail";
|
||||
var dic = new Dictionary<string, object> {
|
||||
|
@ -100,7 +107,7 @@ namespace WZ
|
|||
{ "ad_format", adFormat.ToString()},
|
||||
{ "reason", reason},
|
||||
{ "position", pos},
|
||||
{ "number",AdPlayCountManager.GetAdPlayCount(adFormat)}
|
||||
{ "number",AdPlayCountManager.GetAdsActionCount(adFormat,AdPlayCountManager.SHOWFAIL_COUNT_SUFFIX)}
|
||||
};
|
||||
FireBaseAnalyticsManager.Instance.LogEvent(eventName, dic);
|
||||
ShuShuEvent.Instance.Track(eventName, dic);
|
||||
|
@ -109,11 +116,12 @@ namespace WZ
|
|||
|
||||
public static void TrackAdPosition(AdsType adFormat, string pos)
|
||||
{
|
||||
AdPlayCountManager.IncrementAdsActionCount(adFormat, AdPlayCountManager.ADPOSITION_COUNT_SUFFIX);
|
||||
var eventName = "ad_position";
|
||||
var dic = new Dictionary<string, object> {
|
||||
{ "ad_format", adFormat.ToString()},
|
||||
{ "position", pos},
|
||||
{ "number",AdPlayCountManager.GetAdPlayCount(adFormat)}
|
||||
{ "number",AdPlayCountManager.GetAdsActionCount(adFormat,AdPlayCountManager.ADPOSITION_COUNT_SUFFIX)}
|
||||
};
|
||||
FireBaseAnalyticsManager.Instance.LogEvent(eventName, dic);
|
||||
ShuShuEvent.Instance.Track(eventName, dic);
|
||||
|
|
|
@ -184,7 +184,7 @@ namespace WZ
|
|||
type,
|
||||
type == AdsType.Rewarded ? _rewardAdRevenue : _interstitiaAdRevenue,
|
||||
type == AdsType.Rewarded ? _rvPos : "",
|
||||
AdPlayCountManager.GetAdPlayCount(type));
|
||||
AdPlayCountManager.GetAdsActionCount(type,AdPlayCountManager.PLAY_COUNT_SUFFIX));
|
||||
|
||||
ShuShuEvent.Instance.OnAdRevenueEvent(ClientName,
|
||||
ClientName,
|
||||
|
@ -192,7 +192,7 @@ namespace WZ
|
|||
type.ToString(),
|
||||
type == AdsType.Rewarded ? _rewardAdRevenue : _interstitiaAdRevenue,
|
||||
type == AdsType.Rewarded ? _rvPos : "",
|
||||
AdPlayCountManager.GetAdPlayCount(type));
|
||||
AdPlayCountManager.GetAdsActionCount(type,AdPlayCountManager.PLAY_COUNT_SUFFIX));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -330,7 +330,7 @@ namespace WZ
|
|||
type,
|
||||
adInfo.Revenue,
|
||||
type == AdsType.Rewarded ? _rvPos : "",
|
||||
AdPlayCountManager.GetAdPlayCount(type));
|
||||
AdPlayCountManager.GetAdsActionCount(type,AdPlayCountManager.PLAY_COUNT_SUFFIX));
|
||||
|
||||
ShuShuEvent.Instance.OnAdRevenueEvent(ClientName,
|
||||
adInfo.NetworkName,
|
||||
|
@ -338,7 +338,7 @@ namespace WZ
|
|||
type.ToString(),
|
||||
adInfo.Revenue,
|
||||
type == AdsType.Rewarded ? _rvPos : "",
|
||||
AdPlayCountManager.GetAdPlayCount(type));
|
||||
AdPlayCountManager.GetAdsActionCount(type,AdPlayCountManager.PLAY_COUNT_SUFFIX));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@ namespace WZ
|
|||
erg.placementId.Equals(_topon_rewarded_units) ? AdsType.Rewarded : AdsType.Interstitial,
|
||||
erg.callbackInfo.publisher_revenue,
|
||||
erg.placementId.Equals(_topon_rewarded_units) ? _rvPos : "",
|
||||
AdPlayCountManager.GetAdPlayCount(erg.placementId.Equals(_topon_rewarded_units) ? AdsType.Rewarded : AdsType.Interstitial));
|
||||
AdPlayCountManager.GetAdsActionCount(erg.placementId.Equals(_topon_rewarded_units) ? AdsType.Rewarded : AdsType.Interstitial,AdPlayCountManager.PLAY_COUNT_SUFFIX));
|
||||
|
||||
ShuShuEvent.Instance.OnAdRevenueEvent(ClientName,
|
||||
ClientName + "_" + erg.callbackInfo.network_firm_id,
|
||||
|
@ -318,7 +318,7 @@ namespace WZ
|
|||
erg.placementId.Equals(_topon_rewarded_units) ? AdsType.Rewarded.ToString() : AdsType.Interstitial.ToString(),
|
||||
erg.callbackInfo.publisher_revenue,
|
||||
erg.placementId.Equals(_topon_rewarded_units) ? _rvPos : "",
|
||||
AdPlayCountManager.GetAdPlayCount(erg.placementId.Equals(_topon_rewarded_units) ? AdsType.Rewarded : AdsType.Interstitial));
|
||||
AdPlayCountManager.GetAdsActionCount(erg.placementId.Equals(_topon_rewarded_units) ? AdsType.Rewarded : AdsType.Interstitial,AdPlayCountManager.PLAY_COUNT_SUFFIX));
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -7,7 +7,14 @@ namespace WZ
|
|||
{
|
||||
public class AdPlayCountManager
|
||||
{
|
||||
private const string PLAY_COUNT_SUFFIX = "_PLAY_COUNT";
|
||||
public const string PLAY_COUNT_SUFFIX = "_PLAY_COUNT";
|
||||
public const string CLICK_COUNT_SUFFIX = "_CLICK_COUNT";
|
||||
public const string CLOSE_COUNT_SUFFIX = "_CLOSE_COUNT";
|
||||
public const string STARTLOAD_COUNT_SUFFIX = "_STARTLOAD_COUNT";
|
||||
public const string LOADED_COUNT_SUFFIX = "_LOADED_COUNT";
|
||||
public const string LOADFAIL_COUNT_SUFFIX = "_LOADFAIL_COUNT";
|
||||
public const string SHOWFAIL_COUNT_SUFFIX = "_SHOWFAIL_COUNT";
|
||||
public const string ADPOSITION_COUNT_SUFFIX = "_ADPOSITION_COUNT";
|
||||
|
||||
#region 关键事件数据
|
||||
public static int GetKeyEventPlayCount(string key)
|
||||
|
@ -111,11 +118,12 @@ namespace WZ
|
|||
#endregion
|
||||
|
||||
|
||||
public static int GetAdPlayCount(AdsType adsType)
|
||||
#region 广告播放次数
|
||||
public static int GetAdsActionCount(AdsType adsType, string suffix)
|
||||
{
|
||||
try
|
||||
{
|
||||
string key = GetPlayCountKey(adsType);
|
||||
string key = GetPlayCountKey(adsType,suffix);
|
||||
return PlayerPrefsUtils.GetPlayerPrefsInt(key, 0);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -126,11 +134,11 @@ namespace WZ
|
|||
}
|
||||
|
||||
|
||||
public static void SetAdPlayCount(AdsType adsType, int count)
|
||||
public static void SetAdsActionCount(AdsType adsType, int count, string suffix)
|
||||
{
|
||||
try
|
||||
{
|
||||
string key = GetPlayCountKey(adsType);
|
||||
string key = GetPlayCountKey(adsType,suffix);
|
||||
PlayerPrefsUtils.SavePlayerPrefsInt(key, count);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -139,16 +147,17 @@ namespace WZ
|
|||
}
|
||||
}
|
||||
|
||||
public static void IncrementAdPlayCount(AdsType adsType)
|
||||
public static void IncrementAdsActionCount(AdsType adsType,string suffix)
|
||||
{
|
||||
int currentCount = GetAdPlayCount(adsType);
|
||||
SetAdPlayCount(adsType, currentCount + 1);
|
||||
int currentCount = GetAdsActionCount(adsType,suffix);
|
||||
SetAdsActionCount(adsType, currentCount + 1,suffix);
|
||||
}
|
||||
|
||||
private static string GetPlayCountKey(AdsType adsType)
|
||||
private static string GetPlayCountKey(AdsType adsType,string suffix)
|
||||
{
|
||||
return $"{adsType}{PLAY_COUNT_SUFFIX}";
|
||||
return $"{adsType}{suffix}";
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class Test : MonoBehaviour
|
|||
|
||||
AdsSDKManager.Instance.ShowRewardAd("getcoin",(state,revenue)=>
|
||||
{
|
||||
LoggerUtils.Debug("OnRewardedVideoAdShowed revenue:"+revenue+"+ state:"+state);
|
||||
LoggerUtils.Debug("[kwai] OnRewardedVideoAdShowed revenue:"+revenue+"+ state:"+state);
|
||||
});
|
||||
// var nativeAdPosition = NativeAdPosition.Create(new NativeTemplateStyle
|
||||
// {
|
||||
|
|
Loading…
Reference in New Issue