Menu

Splash ad

1. Ad Introduction

Taku Unity Plugin 2.0.0 supports accessing Splash Ads via C# API. Splash ads are similar to interstitial ads, but are generally displayed when the app is cold-started or hot-started.

2. Integration Suggestions

  1. Cold Start (when the app process does not exist, the app's first launch)

The preferred method for handling cold starts is to create a new scene as the launch page. Load the ad in the Start() method of this scene. If loading times out, do not display the ad. See the sample code for details.

After launching the app or game, call ATSplashAd.Instance.loadSplashAd() to load a splash ad.

Move the preloading logic for other ad formats and other network-resource-consuming requests to after the splash ad is displayed, to reduce splash load timeout situations.

If the ad load times out (onAdLoadTimeoutEvent(object sender, ATAdEventArgs erg)), do not continue waiting for ad fill and directly enter the main interface. This splash ad is still loading; if it loads successfully, it will trigger the

onAdLoadEvent(object sender, ATAdEventArgs erg) onAdLoadEvent(object sender, ATAdEventArgs erg) callback. When triggered, if loading has not timed out (when ATAdEventArgs.isTimeout is false), call ATSplashAd.Instance.showSplashAd() to display the ad.

  1. Hot Start (when the app is temporarily sent to the background via the home button, and the app process still exists, returning to the app)

When the app returns to the foreground, call ATSplashAd.Instance.hasSplashAdReady() to check if there is a cached ad. If true, call ATSplashAd.Instance.showSplashAd() to display the ad. If false, call ATSplashAd.Instance.loadSplashAd() to preload an ad.

  1. It is recommended to call ATSplashAd.Instance.entryScenarioWithPlacementID() after entering a displayable ad scenario to track the cache status of the current ad placement. For specific tracking instructions, see the ad scenario data for distinguishing different business scenarios.

  2. Ad Preloading: After the splash ad is displayed, call load for preloading in the onAdLoadEvent or onAdCloseEvent callback.

If you need to display a splash ad during a hot start, it is recommended to call ATSplashAd.Instance.hasSplashAdReady() when the app goes to the background to check if there is a cached ad. If true, call ATSplashAd.Instance.showSplashAd() to display the ad. If false, call ATSplashAd.Instance.loadSplashAd() to preload an ad.

  1. Configure a fallback splash Ad Source in the dashboard to reduce load timeout situations. See Fallback Splash Ad for the configuration method.

  2. In Unity, listen for app foreground events:

To receive notifications of app foreground events, it is recommended that you listen to the OnApplicationPause event. By overriding the OnApplicationPause method, your app will receive alerts for app launch and foreground events and will be able to display ads.

Note:

  1. You must call load to load an ad only after the Taku SDK Initialization has succeeded.
  2. Only full-screen splash ads are supported.

3. API Description

ATSplashAd:

API Parameters Description
loadSplashAd string placementId, Dictionary Load an ad
hasSplashAdReady string placementId Check if there is a cached ad
checkAdStatus string placementid Get the current ad placement status (JSON string): 1. isLoading: Whether it is loading 2. isReady: Whether there is a cached ad (same as hasSplashAdReady) 3. AdInfo: The highest-priority cached ad info (see ATCallbackInfo Description)
getValidAdCaches string placementid Get all successfully loaded cached ad info (JSON string) (see ATCallbackInfo Description)
showSplashAd string placementid, Dictionary Display an ad
entryScenarioWithPlacementID string placementId, string scenarioID Set entry into a displayable ad scenario

4. Implement Ad Event Listeners

For callback info details, see: Callback Info Description

Use the following code to implement multiple listeners:

java Copy
    var client = ATSplashAd.Instance.client;
    // Ad loaded successfully
    client.onAdLoadEvent += onAdLoad;
    // Ad load failed
    client.onAdLoadFailureEvent += onAdLoadFailed;
    // Ad load timed out
    client.onAdLoadTimeoutEvent += onAdLoadTimeout;
    // Ad displayed successfully
    client.onAdShowEvent += onAdShow;
    // Ad closed
    client.onAdCloseEvent += onAdClose;
    // Ad clicked
    client.onAdClickEvent += onAdClick;

Advanced listener settings:

java Copy
    var client = ATSplashAd.Instance.client;
    // Ad Source initiated request
    client.onAdSourceAttemptEvent += startLoadingADSource;
    // Ad Source loaded successfully
    client.onAdSourceFilledEvent += finishLoadingADSource;
    // Ad Source load failed
    client.onAdSourceLoadFailureEvent += failToLoadADSource;
    // Ad Source Bidding started
    client.onAdSourceBiddingAttemptEvent += startBiddingADSource;
    // Ad Source Bidding succeeded
    client.onAdSourceBiddingFilledEvent += finishBiddingADSource;
    // Ad Source Bidding failed
    client.onAdSourceBiddingFailureEvent += failBiddingADSource;

The method definition parameters are as follows: (Note: You can refer to the code below for method names or use custom method names, but the parameters must be consistent)

java Copy
        // Ad loaded successfully
        public void onAdLoad(object sender,ATAdEventArgs erg)
    {
                if (!erg.isTimeout)    // Not timed out
        {
              Debug.Log("Developer onAdLoad------" + erg.placementId);
        }
          else    // Timed out
        {
              Debug.Log("Developer onAdLoad timeout ------" + erg.placementId);
        }
    }
        // Ad load failed
        public void onAdLoadFailed(object sender,ATAdEventArgs erg)
    {
          Debug.Log("Developer onAdLoadFailed------" + erg.placementId);
    }
        // Ad load timed out
        public void onAdLoadTimeout(object sender,ATAdEventArgs erg)
    {
          Debug.Log("Developer onAdLoadTimeout------" + erg.placementId);
    }
        // Ad displayed
        public void onAdShow(object sender,ATAdEventArgs erg)
    {
          Debug.Log("Developer onAdShow------" + erg.placementId);
    }
        // Ad closed
        public void onAdClose(object sender,ATAdEventArgs erg)
    {
          Debug.Log("Developer onAdClose------" + erg.placementId);
    }
        // Ad clicked
        public void onAdClick(object sender,ATAdEventArgs erg)
    {
          Debug.Log("Developer onAdClick------" + erg.placementId);
    }

        // v5.8.10 added Ad Source-level callbacks
      // Ad Source started loading
    public void startLoadingADSource(object sender,ATAdEventArgs erg){
        Debug.Log("Developer startLoadingADSource------");
    }
      // Ad Source loading completed
        public void finishLoadingADSource(object sender,ATAdEventArgs erg){
        Debug.Log("Developer finishLoadingADSource------");
    }
      // Ad Source failed
        public void failToLoadADSource(object sender,ATAdEventArgs erg){
        Debug.Log("Developer failToLoadADSource------");
    }
      // Ad Source started bidding
        public void startBiddingADSource(object sender,ATAdEventArgs erg){
               Debug.Log("Developer startBiddingADSource------");
    }
      // Ad Source bidding succeeded
        public void finishBiddingADSource(object sender,ATAdEventArgs erg){
        Debug.Log("Developer finishBiddingADSource------");
    }
      // Ad Source bidding failed
        public void failBiddingADSource(object sender,ATAdEventArgs erg){
        Debug.Log("Developer failBiddingADSource------");
    }         

5. Sample Code

java Copy
public class ExampleHomeScreen : MonoBehaviour, ATSDKInitListener
{    
       void Start()
       {
       #if UNITY_ANDROID
        ATSDKAPI.initSDK("Your Android AppId", "Your Android AppKey", this);
#elif UNITY_IOS || UNITY_IPHONE
        ATSDKAPI.initSDK("Your iOS AppId", "Your iOS AppKey", this);
#endif
       }

      void OnDestroy()
    {
        ATSplashAd.Instance.client.onAdLoadEvent -= onAdLoad;
        ATSplashAd.Instance.client.onAdLoadTimeoutEvent -= onAdLoadTimeout;
        ATSplashAd.Instance.client.onAdLoadFailureEvent -= onAdLoadFailed;
                ATSplashAd.Instance.client.onAdCloseEvent -= onAdClose;
    }

      // SDK Initialization succeeded
       public void initSuccess()
       {
        ATSplashAd.Instance.client.onAdLoadEvent += onAdLoad;
        ATSplashAd.Instance.client.onAdLoadTimeoutEvent += onAdLoadTimeout;
        ATSplashAd.Instance.client.onAdLoadFailureEvent += onAdLoadFailed;
        ATSplashAd.Instance.client.onAdCloseEvent += onAdClose;
        ATSplashManager.Instance.ShowAdIfReady();
       }

        public void initFail(string msg)
    {
          Debug.Log("Developer callback SDK initFail:" + msg);
    }
        // Ad loaded successfully, display it directly
          public void onAdLoad(object sender, ATAdEventArgs erg)
    {
           if (!erg.isTimeout)
        {
            ATSplashManager.Instance.ShowAdIfReady();
        }
        else 
        {
            // Load timed out, do not call show to display the ad
        }
    } 
      // Ad load timed out, no need to continue waiting for ad fill, go directly to the home screen
       public void onAdLoadTimeout(object sender, ATAdEventArgs erg)
       {

       }
        // Ad load failed
    public void onAdLoadFailed(object sender, ATAdErrorEventArgs args)
    {

    }
      // Ad closed, go to the home screen
      public void onAdClose(object sender, ATAdEventArgs erg)
    {

    }
         // Listen for app foreground events
       private void OnApplicationPause(bool pauseStatus)
       {
         if (!pauseStatus)    // Returned from background to foreground
         {
             ATSplashManager.Instance.ShowAdIfReady();
         }
       }
}

public class ATSplashManager
    {
#if UNITY_ANDROID
        private const string SPLASH_PLACEMENT_ID = "Your PlacementId";
#elif UNITY_IOS || UNITY_IPHONE
        private static string SPLASH_PLACEMENT_ID = "Your PlacementId";
#endif

        private static ATSplashManager instance = new ATSplashManager();

        public static ATSplashManager Instance
        {
            get
            {
                return instance;
            }
        }

        public void ShowAdIfReady()
        {
            var splashAd = ATSplashAd.Instance;
            if (splashAd.hasSplashAdReady(SPLASH_PLACEMENT_ID))
            {
                splashAd.showSplashAd(SPLASH_PLACEMENT_ID, new Dictionary());
            }
            else
            {
                splashAd.loadSplashAd(SPLASH_PLACEMENT_ID, new Dictionary());
            }
        }
    }
Previous
Native
Next
Callback information description
Last modified: 2026-07-02Powered by