修复开屏问题,开屏添加事件打点

This commit is contained in:
juncong lee 2025-12-12 16:22:21 +08:00
parent c5cf06834f
commit 405b18d878
12 changed files with 79 additions and 62 deletions

View File

@ -1,5 +1,6 @@
using BigoAds.Scripts.Common;
using BigoAds.Scripts.Api.Constant;
using System;
namespace BigoAds.Scripts.Api
{

View File

@ -1 +1 @@
<?xml version="1.0" encoding="utf-8"?><resources><string name="com.crashlytics.android.build_id" translatable="false">99079be3-a6d1-458f-9555-9127e5f23f51</string></resources>
<?xml version="1.0" encoding="utf-8"?><resources><string name="com.crashlytics.android.build_id" translatable="false">11bce6fa-2fca-4ea8-b4fa-16e19bb0cafb</string></resources>

Binary file not shown.

View File

@ -4,12 +4,12 @@ apply plugin: 'com.android.library'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
implementation 'androidx.annotation:annotation:1.2.0' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/kwai/Editor/Dependencies.xml:6
implementation 'androidx.appcompat:appcompat:1.6.1' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/kwai/Editor/Dependencies.xml:4
implementation 'androidx.annotation:annotation:1.2.0' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/kwai/Editor/Dependencies.xml:8
implementation 'androidx.appcompat:appcompat:1.6.1' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/kwai/Editor/Dependencies.xml:6
implementation 'androidx.browser:browser:1.4.0' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/Editor/Dependencies.xml:4
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:12
implementation 'androidx.lifecycle:lifecycle-process:2.6.2' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:17
implementation 'androidx.media3:media3-exoplayer:1.0.0-alpha01' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/kwai/Editor/Dependencies.xml:3
implementation 'androidx.media3:media3-exoplayer:1.0.0-alpha01' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/kwai/Editor/Dependencies.xml:5
// implementation 'androidx.recyclerview:recyclerview:1.1.0' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/gtm/Editor/Dependencies.xml:7
implementation 'androidx.recyclerview:recyclerview:1.2.1' // Assets/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml:9
implementation 'com.adjust.sdk:adjust-android:5.4.2' // Assets/Adjust/Native/Editor/Dependencies.xml:5
@ -34,7 +34,7 @@ dependencies {
implementation 'com.google.android.gms:play-services-ads-identifier:18.2.0' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/pangle/Editor/Dependencies.xml:7
implementation 'com.google.android.gms:play-services-base:18.7.2' // Assets/Firebase/Editor/AppDependencies.xml:17
implementation 'com.google.android.gms:play-services-basement:18.1.0' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/vungle/Editor/Dependencies.xml:4
implementation 'com.google.android.material:material:1.2.1' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/kwai/Editor/Dependencies.xml:5
implementation 'com.google.android.material:material:1.2.1' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/kwai/Editor/Dependencies.xml:7
implementation 'com.google.android.ump:user-messaging-platform:3.2.0' // Assets/GoogleMobileAds/Editor/GoogleUmpDependencies.xml:7
implementation 'com.google.firebase:firebase-analytics:23.0.0' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:15
implementation 'com.google.firebase:firebase-analytics-unity:13.2.0' // Assets/Firebase/Editor/AnalyticsDependencies.xml:18
@ -53,7 +53,9 @@ dependencies {
implementation 'com.thinkup.sdk:debugger-ui:1.1.1' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/Editor/Dependencies.xml:6
implementation 'com.unity3d.ads:unity-ads:4.14.0' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/unityads/Editor/Dependencies.xml:3
implementation 'com.vungle:vungle-ads:7.5.0' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/vungle/Editor/Dependencies.xml:3
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.10' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/kwai/Editor/Dependencies.xml:7
implementation 'io.github.kwainetwork:adApi:1.2.15' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/kwai/Editor/Dependencies.xml:3
implementation 'io.github.kwainetwork:adImpl:1.2.15' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/kwai/Editor/Dependencies.xml:4
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.10' // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/kwai/Editor/Dependencies.xml:9
// Android Resolver Dependencies End
**DEPS**}

View File

@ -5,7 +5,6 @@ using System.IO;
using System.Security.Cryptography;
using System.Text;
using Google.MiniJSON;
using Unity.VisualScripting.Dependencies.NCalc;
using UnityEngine;
namespace WZ

View File

@ -4,8 +4,6 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using AdjustSdk;
using ThinkingData.Analytics;
using Unity.VisualScripting;
using Unity.VisualScripting.Antlr3.Runtime.Tree;
using UnityEngine;
using WZ;

View File

@ -269,13 +269,19 @@ namespace WZ
private void OnSplashAdLoaded(string adSource,string adUnitId)
{
_splashLoaded = true;
_retryAttempt = 0;
AdsActionEvents.TrackAdLoaded(Platfrom,adSource,adUnitId,AdsType.Splash,Time.realtimeSinceStartup - _spStartLoadTime);
}
private int _retryAttempt = 0;
private void OnSplashAdLoadFailed(string adUnitId, int errorCode, string errorMsg)
{
_splashLoaded = true;
_retryAttempt++;
double retryDelay = Math.Pow(2, Math.Min(6, _retryAttempt));
Invoke(nameof(LoadSplash), (float)retryDelay);
AdsActionEvents.TrackAdFailToLoad(Platfrom,"","",AdsType.Splash,Time.realtimeSinceStartup - _spStartLoadTime,errorMsg);
}
private void OnSplashAdShowed(string adUnitId)
@ -288,12 +294,14 @@ namespace WZ
AdsActionEvents.TrackAdClosed(Platfrom, adSource, adUnitId, AdsType.Splash, "", revenue);
AdsSDKManager.Instance.otherAdsOnShow = false;
AdsSplashManager.Instance.OnSplashAdCloseCallback?.Invoke();
LoadSplash();
}
private void OnSplashAdError(string adUnitId, int errorCode, string errorMsg)
{
AdsSDKManager.Instance.otherAdsOnShow = false;
AdsSplashManager.Instance.OnSplashAdCloseCallback?.Invoke();
LoadSplash();
}
private void OnSplashAdClicked(string adSource,string adUnitId,double revenue)

View File

@ -4,7 +4,6 @@ using System.Collections.Generic;
using Firebase.RemoteConfig;
using GoogleMobileAds.Api;
using GoogleMobileAds.Common;
using Unity.VisualScripting;
using UnityEngine;
namespace WZ
@ -13,7 +12,7 @@ namespace WZ
{
public float backgroundTime = 0;
private int timeoutDuration = 5;
private bool _coldLaunch = true;
private bool _coldLaunch = false;
public Action OnSplashAdCloseCallback;
public void SetSplashAdCloseCallback(Action action)
@ -23,6 +22,7 @@ namespace WZ
public void InitSplash()
{
timeoutDuration = GetSplashConfigItem().loadtime;
_coldLaunch = true;
var isNew = PlayerPrefsUtils.GetPlayerPrefsInt("Firstcold_Splash_Switch", 0) == 0;
if (isNew)
{
@ -71,8 +71,10 @@ namespace WZ
private void CheckSplashAdlash(bool isCold)
{
if (!isCold)
{
AdsActionEvents.TrackAdPosition(AdsType.Splash, "Hot",(Time.realtimeSinceStartup - backgroundTime).ToString(),GetSplashConfigItem().hot_splash_switch.ToString());
// 热启动
// 当前有其他类型广告在展示
LoggerUtils.Debug(" [AppOpen] 热启动 是否有广告在展示:" + AdsSDKManager.Instance.otherAdsOnShow);
@ -83,6 +85,7 @@ namespace WZ
LoggerUtils.Debug(" [AppOpen] 热启动 开关:" + hotSplashSwitch);
if (!hotSplashSwitch)
{
AdsActionEvents.TrackAdFailToShow(AdsType.Splash, "Hot", AdsShowFailType.RuleLimit);
return;
}
@ -92,13 +95,14 @@ namespace WZ
LoggerUtils.Debug(" [AppOpen] 后台运行时间差值:" + resultTime + " 在线参数值:" + onlineTime);
if (resultTime < onlineTime)
{
AdsActionEvents.TrackAdFailToShow(AdsType.Splash, "Hot", AdsShowFailType.RuleLimit);
return;
}
Invoke(nameof(TrackAdImpression), 10);
if (!AdsSDKManager.Instance.IsSplashAvailable())
{
LoggerUtils.Debug(" [AppOpen] 热启动 广告是否准备好:");
AdsActionEvents.TrackAdFailToShow(AdsType.Splash, "", AdsShowFailType.NoFill);
AdsActionEvents.TrackAdFailToShow(AdsType.Splash, "Hot", AdsShowFailType.NoFill);
AdsSDKManager.Instance.LoadSplashAd();
return;
}
@ -110,7 +114,7 @@ namespace WZ
{
// 冷启动
// 首次启动
Invoke(nameof(TrackAdImpression), 10);
Invoke(nameof(TrackColdAdPosition), 10);
var isNew = PlayerPrefsUtils.GetPlayerPrefsInt("Firstcold_Splash_Switch", 0) == 0;
// 首次冷启动开关
var isFirstShow = GetSplashConfigItem().firstcold_splash_switch == 1;
@ -125,6 +129,7 @@ namespace WZ
{
// 新用户首次不展示
LoggerUtils.Debug(" [AppOpen] 冷启动 新用户首次启动 不展示 :"+OnSplashAdCloseCallback);
AdsActionEvents.TrackAdFailToShow(AdsType.Splash, "Cold", AdsShowFailType.RuleLimit);
OnSplashAdCloseCallback?.Invoke();
}
else
@ -136,7 +141,7 @@ namespace WZ
}
else
{
AdsActionEvents.TrackAdFailToShow(AdsType.Splash, "", AdsShowFailType.NoFill);
AdsActionEvents.TrackAdFailToShow(AdsType.Splash, "Cold", AdsShowFailType.NoFill);
OnSplashAdCloseCallback?.Invoke();
AdsSDKManager.Instance.LoadSplashAd();
LoggerUtils.Debug(" [AppOpen] 冷启动广告未准备好");
@ -155,26 +160,28 @@ namespace WZ
}
else
{
AdsActionEvents.TrackAdFailToShow(AdsType.Splash, "", AdsShowFailType.NoFill);
AdsActionEvents.TrackAdFailToShow(AdsType.Splash, "Cold", AdsShowFailType.NoFill);
OnSplashAdCloseCallback?.Invoke();
AdsSDKManager.Instance.LoadSplashAd();
}
}
else
{
AdsActionEvents.TrackAdFailToShow(AdsType.Splash, "Cold", AdsShowFailType.RuleLimit);
OnSplashAdCloseCallback?.Invoke();
}
}
}
}
private void TrackAdImpression()
{
AdsActionEvents.TrackAdPosition(AdsType.Splash,"");
private void TrackColdAdPosition()
{
AdsActionEvents.TrackAdPosition(AdsType.Splash, "Cold","0",GetSplashConfigItem().cold_splash_switch.ToString());
}
private static string Splash_AD_RULES = "Splash_AD_RULES";
private static string Splash_AD_RULES_DEFAULT_VALUE = "[{\"firstcold_splash_switch\":0,\"cold_splash_switch\":1,\"hot_splash_switch\":1,\"hot_timegap\":30,\"loadtime\":5}]";
private static string Splash_AD_RULES_DEFAULT_VALUE = "[{\"firstcold_splash_switch\":1,\"cold_splash_switch\":1,\"hot_splash_switch\":1,\"hot_timegap\":30,\"loadtime\":2}]";
public SplashConfigItem GetSplashConfigItem()
{
@ -182,13 +189,12 @@ namespace WZ
SplashConfigItem[] configItems = DataUtils.FromJsonArray<SplashConfigItem>(jsonData);
if (configItems.Length == 0 || configItems == null)
{
return new SplashConfigItem() { firstcold_splash_switch = 0, cold_splash_switch = 1, hot_splash_switch = 1, hot_timegap = 30, loadtime = 15 };
return new SplashConfigItem() { firstcold_splash_switch = 1, cold_splash_switch = 1, hot_splash_switch = 1, hot_timegap = 30, loadtime = 2 };
}
else
{
return configItems[0];
}
}
[System.Serializable]

View File

@ -182,13 +182,15 @@ namespace WZ
LoggerUtils.Debug("[actionevent] TrackAdFailToShow"+JsonMapper.ToJson(dic));
}
public static void TrackAdPosition(AdsType adFormat, string pos)
public static void TrackAdPosition(AdsType adFormat, string pos, string backgroundTime = "0", string splashSwitch = "")
{
AdPlayCountManager.IncrementAdsActionCount(adFormat, AdPlayCountManager.ADPOSITION_COUNT_SUFFIX);
var eventName = "ad_position";
var dic = new Dictionary<string, object> {
{ "ad_format", adFormat.ToString()},
{ "position", pos},
{ "backgroundTime", backgroundTime},
{"splashSwitch",splashSwitch},
{ "number",AdPlayCountManager.GetAdsActionCount(adFormat,AdPlayCountManager.ADPOSITION_COUNT_SUFFIX)}
};
FireBaseAnalyticsManager.Instance.LogEvent(eventName, dic);

View File

@ -1,6 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
namespace WZ

View File

@ -49,6 +49,8 @@
<package>com.thinkup.sdk:debugger-ui:1.1.1</package>
<package>com.unity3d.ads:unity-ads:4.14.0</package>
<package>com.vungle:vungle-ads:7.5.0</package>
<package>io.github.kwainetwork:adApi:1.2.15</package>
<package>io.github.kwainetwork:adImpl:1.2.15</package>
<package>org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.10</package>
</packages>
<files>

View File

@ -14,7 +14,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_PixelRect:
serializedVersion: 2
x: 0
x: -1
y: 65
width: 1470
height: 891
@ -120,7 +120,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 100}
m_MaxSize: {x: 24288, y: 16192}
vertical: 0
controlID: 24
controlID: 15
draggingID: 0
--- !u!114 &6
MonoBehaviour:
@ -141,12 +141,12 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 831
width: 971
height: 841
m_MinSize: {x: 100, y: 100}
m_MaxSize: {x: 8096, y: 16192}
vertical: 1
controlID: 25
controlID: 16
draggingID: 0
--- !u!114 &7
MonoBehaviour:
@ -165,8 +165,8 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 831
height: 185.5
width: 971
height: 319.5
m_MinSize: {x: 201, y: 221}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 12}
@ -191,9 +191,9 @@ MonoBehaviour:
m_Position:
serializedVersion: 2
x: 0
y: 185.5
width: 831
height: 655.5
y: 319.5
width: 971
height: 521.5
m_MinSize: {x: 231, y: 271}
m_MaxSize: {x: 10001, y: 10021}
m_ActualView: {fileID: 14}
@ -217,12 +217,12 @@ MonoBehaviour:
m_Children: []
m_Position:
serializedVersion: 2
x: 831
x: 971
y: 0
width: 212
width: 183
height: 841
m_MinSize: {x: 202, y: 221}
m_MaxSize: {x: 4002, y: 4021}
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 16}
m_Panes:
- {fileID: 16}
@ -243,12 +243,12 @@ MonoBehaviour:
m_Children: []
m_Position:
serializedVersion: 2
x: 1043
x: 1154
y: 0
width: 427
width: 316
height: 841
m_MinSize: {x: 641, y: 601}
m_MaxSize: {x: 4001, y: 4021}
m_MinSize: {x: 640, y: 580}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 17}
m_Panes:
- {fileID: 11}
@ -296,7 +296,7 @@ MonoBehaviour:
m_CachedPref: 226
m_ControlHash: -371814159
m_PrefName: Preview_InspectorPreview
m_LastInspectedObjectInstanceID: -1
m_LastInspectedObjectInstanceID: 24842
m_LastVerticalScrollValue: 0
m_GlobalObjectId:
m_InspectorMode: 0
@ -323,10 +323,10 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 0
x: -1
y: 95
width: 830
height: 164.5
width: 970
height: 298.5
m_SerializedDataModeController:
m_DataMode: 0
m_PreferredDataMode: 0
@ -1013,10 +1013,10 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 0
y: 280.5
width: 830
height: 634.5
x: -1
y: 414.5
width: 970
height: 500.5
m_SerializedDataModeController:
m_DataMode: 0
m_PreferredDataMode: 0
@ -1073,7 +1073,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: da400000
m_LastClickedID: 16602
m_ExpandedIDs: 00000000846c0000866c0000886c00008a6c00008c6c00008e6c0000906c0000926c0000946c0000966c0000986c00009a6c00009c6c00009e6c0000a06c0000a26c0000a46c0000a66c0000a86c0000aa6c0000ac6c0000ae6c0000
m_ExpandedIDs: 000000003e6b0000406b0000426b0000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -1101,7 +1101,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: ffffffff00000000846c0000866c0000886c00008a6c00008c6c00008e6c0000906c0000926c0000946c0000966c0000986c00009a6c00009e6c0000a06c0000a26c0000a46c0000a66c0000a86c0000aa6c0000ac6c0000ae6c0000
m_ExpandedIDs: ffffffff000000003e6b0000426b0000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -1153,7 +1153,7 @@ MonoBehaviour:
m_Icon: {fileID: 0}
m_ResourceFile:
m_NewAssetIndexInList: -1
m_ScrollPosition: {x: 0, y: 0}
m_ScrollPosition: {x: 0, y: 186.5}
m_GridSize: 16
m_SkipHiddenPackages: 0
m_DirectoriesAreaWidth: 82
@ -1177,10 +1177,10 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 0
y: 280.5
width: 611
height: 634.5
x: -1
y: 414.5
width: 970
height: 500.5
m_SerializedDataModeController:
m_DataMode: 0
m_PreferredDataMode: 0
@ -1211,9 +1211,9 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 831
x: 970
y: 95
width: 210
width: 181
height: 820
m_SerializedDataModeController:
m_DataMode: 0
@ -1228,9 +1228,9 @@ MonoBehaviour:
m_SceneHierarchy:
m_TreeViewState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 2a6d00002c6d00002e6d0000306d0000326d0000346d0000366d0000386d00003a6d00003c6d00003e6d0000406d0000426d0000446d0000466d00009c6c00006a6d00006c6d00006e6d0000706d0000
m_SelectedIDs: be6b0000c06b0000c26b0000c46b0000c66b0000c86b0000ca6b0000cc6b0000ce6b0000d06b0000d26b0000d46b0000406b0000f06b0000f26b0000f46b0000f66b0000f86b0000fa6b0000fc6b0000
m_LastClickedID: 0
m_ExpandedIDs: 2efbffff
m_ExpandedIDs: 22fbffff
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -1274,9 +1274,9 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 1043
x: 1153
y: 95
width: 426
width: 315
height: 820
m_SerializedDataModeController:
m_DataMode: 0