Menu

Splash ads

Importing the Splash Ad SDK:

swift Copy
import 'package:anythink_sdk/at_index.dart';
swift Copy
  loadSplash() async {
        ATSplashManager.loadSplash(
        placementID: 'you placementId',
        extraMap: {
         //1.0.13及以上支持底部logo 
        //bottomTemplate模版名称,bottomRatio高度占比系数建议不大于20%
        ATSplashManager.bottomTemplate(): template,
        ATSplashManager.bottomRatio(): 0.18,
        }
    );
  }

The default ad load timeout is 5000 milliseconds. If you need to adjust the ad load timeout (unit: milliseconds), you need to pass the following parameter:

tolerateTimeout(): int, required, used to set the load timeout.

Copy
  loadSplash() async {
        ATSplashManager.loadSplash(
        placementID: 'you placementId',
        extraMap: {
          ATSplashManager.tolerateTimeout(): 5000
        });
  }

1.2 Check if There Is a Cached Ad and Get Ad Status

Use the following code to check if there is a cached ad:

swift Copy
  splashReady() async {
    await ATSplashManager
        .splashReady(
        placementID: 'you placementId'
    )
  }

Use the following code to get the ad status (return value type is Map). The key-value pairs are as follows:

  1. isLoading: Whether it is loading

  2. isReady: Whether there is a cached ad

  3. adInfo: The highest-priority cached ad info

swift Copy
  checkSplashLoadStatus() async {
    await ATSplashManager
        .checkSplashLoadStatus(
        placementID: 'you placementId'
    )
  }

Get information about all available ads under the current ad placement

swift Copy
  getSplashValidAds() async {
    await ATSplashManager.getSplashValidAds(
        placementID: 'you placementId'
    )
  }

1.3 Enter Scenario

swift Copy
entrySplashScenario() async {
        ATSplashManager.entrySplashScenario(
        placementID:'you placementId',
        sceneID: 'you sceneID',
        );
  }

To display a splash ad, simply call the show API and pass the ad placement ID.

swift Copy
  showSplash() async {
        ATSplashManager
        .showSplash(
        placementID: 'you placementId'
    );
  }

When using the scenario feature, display the ad through this API. Parameters: Ad Placement ID + Scenario ID (the Scenario ID can be created in the Taku dashboard)

swift Copy
  showSceneSplash() async {
         ATSplashManager
        .showSceneSplash(
      sceneID: 'you sceneID',
      placementID: 'you placementId',
    );
  }

1.5 Implement Splash Ad Listeners

ATSplashResponse property description:

SplashStatus: Splash status

placementID: placementID

requestMessage: Request info (error message)

extraMap: Callback Info

isDeeplinkSuccess: isDeeplinkSuccess

isTimeout: Whether the ad load has timed out when it succeeds

See the sample code below:

swift Copy
  splashListen() {
    ATListenerManager.splashEventHandler.listen((value) {

      switch (value.splashStatus) {
      // Ad load failed
        case SplashStatus.splashDidFailToLoad:
          print("flutter splash--splashDidFailToLoad ---- placementID: ${value.placementID} ---- errStr:${value.requestMessage}");
          break;
      // Ad loaded successfully 
        case SplashStatus.splashDidFinishLoading:
          print("flutter splash--splashDidFinishLoading ---- placementID: ${value.placementID} ---- isTimeout:${value.isTimeout}");
          break;
      // Ad load 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
        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;
      }
    });
  }

1.6 Preset Strategy Settings (Recommended)

To improve the ad loading effect on the first cold start, create a traffic group under the SDK preset strategy on the splash ad placement, then configure the waterfall in this traffic group. It is also recommended to add a fallback Ad Source. Finally, export the SDK preset strategy and pre-install it in the app. For specific integration documentation, see the Preset Strategy Usage Instructions.

Configuration effect: Enables SDK preset splash strategy and implements the fallback function of the splash fallback Ad Source. That is: this fallback Ad Source will initiate requests in parallel with the overall waterfall under the ad placement. Also, users will not necessarily use the fallback ad on the first request; instead, the normal waterfall and the fallback Ad Source will proceed in parallel. This maximizes monetization value.

1.6.1 Set the Exported JSON File Path

Call before Initializing the SDK.

Copy
setPresetPlacementConfigPath() async {
    await ATInitManger.setPresetPlacementConfigPath(
        pathStr: "localStrategy"
    );
 }

1. Android Notes

(1) Create a new directory named localStrategy under the project's src/main/assets directory. The directory naming rule can be customized and used for the following steps.

(2) Place the JSON file exported from the dashboard into the newly created directory src/main/assets/localStrategy.

(3) If you change the name of localStrategy, the pathStr parameter passed in setPresetPlacementConfigPath must be correspondingly updated with the adjusted string.

2. iOS Notes

(1) The JSON file exported from the dashboard must be placed in the Bundle where the project is located (NSBundle mainBundle, the placement path cannot be modified).

(2) The pathStr parameter has no effect on iOS.

Previous
Initialization instructions
Next
Rewarded video
Last modified: 2026-07-10Powered by