Search...
Menu

Interstitial Ads

πŸ’‘Tips

  • Automatically manages multi-placement parallel loading, caching, and price-comparison display, developer only needs SmartLoad β†’ SmartIsReady β†’ SmartShow
  • Must ensure McSdk.InitializeSdk() is completed before calling SmartLoadInterstitial(), otherwise the call will be ignored
  • SDK automatically refills after ad is closed, no need to manually reload
  • Smart Cache has an independent callback channel McSdkCallbacks.SmartCache.Interstitial, completely isolated from the standard ad placement callback McSdkCallbacks.Interstitial

csharp Copy
public void InitializeSmartInterstitialAd()
{
    // Smart Cache independent callback channel (completely isolated from Ad Placement Mode)
    McSdkCallbacks.SmartCache.Interstitial.OnDidLoadAd += OnSmartInterstitialAdLoaded;
    McSdkCallbacks.SmartCache.Interstitial.OnDidFailToLoadAd += OnSmartInterstitialAdLoadFailed;
    McSdkCallbacks.SmartCache.Interstitial.OnDidDisplayAd += OnSmartInterstitialAdDisplayed;
    McSdkCallbacks.SmartCache.Interstitial.OnDidHideAd += OnSmartInterstitialAdHidden;
    McSdkCallbacks.SmartCache.Interstitial.OnDidClickAd += OnSmartInterstitialAdClicked;
    McSdkCallbacks.SmartCache.Interstitial.OnDidFailToDisplayAd += OnSmartInterstitialAdDisplayFailed;
    McSdkCallbacks.SmartCache.Interstitial.OnDidPayRevenueForAd += OnSmartInterstitialAdRevenuePaid;
    McSdkCallbacks.SmartCache.Interstitial.OnDidAdLoadFinished += OnSmartInterstitialAdLoadFinished;

    // No need to pass adUnitId, managed by server strategy
    McSdk.SmartLoadInterstitial();
}

private void OnSmartInterstitialAdLoaded(string adUnitId, McSdkBase.AdInfo adInfo)
{
    // At least one ad is ready
}

private void OnSmartInterstitialAdLoadFailed(McSdkBase.ErrorInfo errorInfo)
{
    // All ad placements failed to load
    // Automatically retries, no manual reload needed
}

private void OnSmartInterstitialAdDisplayed(string adUnitId, McSdkBase.AdInfo adInfo)
{
    // Display success callback
}

private void OnSmartInterstitialAdHidden(string adUnitId, McSdkBase.AdInfo adInfo)
{
    // Ad closed callback
    // SDK automatically refills, no manual operation needed
}

private void OnSmartInterstitialAdClicked(string adUnitId, McSdkBase.AdInfo adInfo)
{
    // Click callback
}

private void OnSmartInterstitialAdDisplayFailed(McSdkBase.ErrorInfo errorInfo, McSdkBase.AdInfo adInfo)
{
    // Display failed callback
    // Automatically handled, no manual reload needed
}

private void OnSmartInterstitialAdRevenuePaid(string adUnitId, McSdkBase.AdInfo adInfo)
{
    // Revenue callback
}

private void OnSmartInterstitialAdLoadFinished()
{
    // End of all ad placements load round callback (triggers regardless of success or failure)
    // Differences from OnDidLoadAd / OnDidFailToLoadAd:
    // OnDidLoadAd β€” triggers when at least one ad placement loads successfully
    // OnDidFailToLoadAd β€” triggers when all ad placements fail to load
    // OnDidAdLoadFinished β€” always triggers when the current load round finishes
}

⚠️ Note: In Smart Cache mode, there is no need to manually call SmartLoadInterstitial() in the OnDidFailToLoadAd / OnDidFailToDisplayAd / OnDidHideAd callbacks to reload. The SDK automatically manages refill and retry internally.

πŸ“Œ Duplicate calls to SmartLoadInterstitial() during loading will be automatically ignored, developers do not need to manually handle anti-duplicate logic.

πŸ“Œ Smart Cache callback McSdkCallbacks.SmartCache.Interstitial is completely isolated from the standard ad placement callback McSdkCallbacks.Interstitial. Both callback sets can be registered simultaneously without interference.


csharp Copy
if (McSdk.SmartIsInterstitialReady()) {
    // SDK automatically selects the ad with the highest eCPM from the cache pool to show
    McSdk.SmartShowInterstitial();
}

πŸ“Œ When SmartIsInterstitialReady() returns false, the SDK automatically triggers background refill, developers do not need to perform additional operations.

πŸ“Œ After the ad is shown, the SDK automatically refills, maintaining available ads in the cache pool.


3. Set Custom Parameters

csharp Copy
McSdk.SmartSetInterstitialExtraParameter("key", "value");
#if UNITY_ANDROID
    McSdk.SmartSetInterstitialLocalExtraParameter("key", new AndroidJavaObject("java.lang.String", "value"));
#elif UNITY_IOS
    McSdk.SmartSetInterstitialLocalExtraParameter("key", "value");
#endif

// Must be set before SmartLoadInterstitial(), parameters take effect for all subsequent load requests
McSdk.SmartLoadInterstitial();

Last modified: 2026-04-03Powered by