Import Splash Ad SDK:
import 'package:secmtp_sdk/at_index.dart';
import 'package:thinkup_sdk/at_index.dart';
loadSplash() async {
await ATSplashManager.loadSplash(
placementID: 'your placementId',
extraMap: {}
);
}
The default ad loading timeout duration is 5000 milliseconds. If you need to adjust the ad loading timeout duration (unit: milliseconds), you must pass the following parameter:
tolerateTimeout(): int, required, used to set the loading timeout duration
loadSplash() async {
await ATSplashManager.loadSplash(
placementID: 'your placementId',
extraMap: {
ATSplashManager.tolerateTimeout(): 5000
});
}
Use the following code to check if there is ad cache:
splashReady() async {
await ATSplashManager
.splashReady(
placementID: 'your placementId'
);
}
entrySplashScenario() async {
await ATSplashManager.entrySplashScenario(
placementID:'your placementId',
sceneID: 'your sceneID',
);
}
To show the splash ad, simply call the display API and pass the display placement ID
showSplash() async {
await ATSplashManager
.showSplash(
placementID: 'your placementId'
);
}
When using the scene function, display the ad through this API with parameters: Placement ID + Scene ID (Scene ID can be created via the TopOn backend)
showSceneSplash() async {
await ATSplashManager
.showSceneSplash(
sceneID: 'your sceneID',
placementID: 'your placementId',
);
}
Introduction to ATSplashResponse properties:
SplashStatus: Splash ad status
placementID: Placement ID
requestMessage: Request information (error information)
extraMap: Callback Information
isDeeplinkSuccess: Whether DeepLink is successful
isTimeout: Whether the ad loading has timed out when the ad is loaded successfully
Refer to the sample code below:
splashListen() {
ATListenerManager.splashEventHandler.listen((value) {
switch (value.splashStatus) {
// Ad loading failed
case SplashStatus.splashDidFailToLoad:
print("flutter splash--splashDidFailToLoad ---- placementID: ${value.placementID} ---- errStr:${value.requestMessage}");
break;
// Ad loading succeeded
case SplashStatus.splashDidFinishLoading:
print("flutter splash--splashDidFinishLoading ---- placementID: ${value.placementID} ---- isTimeout:${value.isTimeout}");
break;
// Ad loading timed out
case SplashStatus.splashDidTimeout:
print("flutter splash--splashDidTimeout ---- placementID: ${value.placementID}");
break;
// Ad displayed successfully
case SplashStatus.splashDidShowSuccess:
print("flutter splash--splashDidShowSuccess ---- placementID: ${value.placementID} ---- extra:${value.extraMap}");
break;
// Ad display failed
case SplashStatus.splashDidShowFailed:
print("flutter splash--splashDidShowFailed ---- placementID: ${value.placementID} ---- errStr:${value.requestMessage}");
break;
// Ad clicked
case SplashStatus.splashDidClick:
print("flutter splash--splashDidClick ---- placementID: ${value.placementID} ---- extra:${value.extraMap}");
break;
// DeepLink triggered
case SplashStatus.splashDidDeepLink:
print("flutter splash--splashDidDeepLink ---- placementID: ${value.placementID} ---- extra:${value.extraMap} ---- isDeeplinkSuccess:${value.isDeeplinkSuccess}");
break;
// Ad closed
case SplashStatus.splashDidClose:
print("flutter splash--splashDidClose ---- placementID: ${value.placementID} ---- extra:${value.extraMap}");
break;
case SplashStatus.splashUnknown:
print("flutter splash--splashUnknown");
break;
}
});
}
To improve the ad loading effect of the first cold start, create a traffic group with SDK preset strategy for the splash ad placement, then configure a waterfall for this traffic group. It is also recommended to add a fallback ad source. Finally, export the SDK preset strategy and preset it into the application. For detailed integration documents, see the SDK Preset Strategy Usage Instructions.
Configuration Effect: It can implement SDK preset splash ad strategy and achieve the fallback function of the splash fallback ad source simultaneously. That is: this fallback ad source will initiate requests in parallel with the overall waterfall under the ad placement. Moreover, users will not necessarily use the fallback ad for the first request, but follow the parallel requests of the normal waterfall and fallback ad source. This can maximize monetization value.
Call before initializing the SDK
setPresetPlacementConfigPath() async {
await ATInitManger.setPresetPlacementConfigPath(
pathStr: "localStrategy"
);
}
(1) Create a new directory named localStrategy under the src/main/assets directory of the project (the directory naming rule can be customized) for the following steps
(2) Place the JSON file exported from the backend into the newly created directory: src/main/assets/localStrategy
(3) If you adjust the name of localStrategy, the pathStr parameter passed to setPresetPlacementConfigPath must be the adjusted string
(1) You must place the JSON file exported from the backend into the Bundle of the project ([NSBundle mainBundle], the placement path cannot be modified)
(2) The pathStr parameter does not take effect for iOS