Release Notes: (1.0.3)
  • Updated to Leadbolt iOS SDK v5.0.

Integration Guide - Leadbolt Ad Plugin

Platforms: Android & iOS
Plugin version: 1.0.3
Leadbolt iOS SDK version: 5.0
Leadbolt Android SDK version: Latest

Generally you don't have to dive into the documentation from Leadbolt, simply follow a few steps below to get the plugin integrated in your App in minutes:

[1] Import the LeadboltAd[Android|IOS|Universal].unitypackage file to your unity project;

[2] Follow the instructions below to configure the plugin.

· >>> For Android platform, click on the menu item of Unity top menu bar: NeatPlug -> LeadboltAd -> Patch Android Configuration. This is for generating a valid AndroidManifest.xml or patching the existing file with LeadboltAd support.


· >>> For iOS platform, click on the menu item of Unity top menu bar: NeatPlug -> LeadboltAd -> Patch iOS Configuration. This is for automatically adding iOS SDK frameworks, libraries or patching the Info.plist file (if needed) as long as the Xcode project is generated by Unity.

[3] Find LeadboltAdAgent Prefab and LeadboltAdListener Prefab in Assets/Standard Assets/NeatPlug/Ads/LeadboltAd/Prefabs/, open the first scene of your game, drag & drop those two prefabs into the scene.

[4] Okay, the integration is done here. Now set up your Ad by filling in a few properties of the LeadboltAdAgent gameObject which you just dropped in the Hierarchy window. To do this, simply select that gameObject, and look at its properties in the Inspector window, you need to fill in:

   · Section Id Banner [Android|IOS] - Section ID for Banner Ads.

   · Section Id Interstitial [Android|IOS] - Section ID for Interstitial Ads.

   · Section Id Overlay [Android|IOS] - Section ID for Overlay Ads.

   · Section Id App Wall [Android|IOS] - Section ID for App Wall Ads.

   · Section Id In App Alert [Android|IOS] - Section ID for In-App-Alert Ads.

   · Section Id Rich Meida [Android|IOS] - Section ID for Rich Media Ads.

   · Section Id Floating [Android|IOS] - Section ID for Floating Ads.

   · Section Id Reengagement [Android|IOS] - Section ID for user Reengagement, reengagement will be auto-enabled if a valid value is supplied.

   · Auto Load Banner Ad - Check this if you want to load banner Ad automatically.

   · Auto Load Banner Ad In Scenes - In which scenes(levels) you want the banner Ad to be auto-loaded. (Set size to zero for all scenes)

   · Auto Load Interstitial Ad On Level Loaded - Check this if you want to display interstitial Ad automatically when a scene is loaded.

   · Show Interstitial Ad In Scenes - In which scenes(levels) you want the interstitial Ad to be shown as long as the scene is loaded.

   · Auto Load Overlay Ad On Level Loaded - Check this if you want to display Overlay Ad automatically when a scene is loaded.

   · Show Overlay Ad In Scenes - In which scenes(levels) you want the Overlay Ad to be shown as long as the scene is loaded.

   · Auto Load App Wall Ad On Level Loaded - Check this if you want to display App Wall Ad automatically when a scene is loaded.

   · Show App Wall Ad In Scenes - In which scenes(levels) you want the App Wall Ad to be shown as long as the scene is loaded.

   · Auto Load In App Alert Ad On Level Loaded - Check this if you want to display In App Alert Ad automatically when a scene is loaded.

   · Show In App Alert Ad In Scenes - In which scenes(levels) you want the In App Alert Ad to be shown as long as the scene is loaded.

   · Auto Load Rich Meida Ad On Level Loaded - Check this if you want to display Rich Meida Ad automatically when a scene is loaded.

   · Show Rich Meida Ad In Scenes - In which scenes(levels) you want the Rich Meida Ad to be shown as long as the scene is loaded.

   · Auto Load Floating Ad On Level Loaded - Check this if you want to display Floating Ad automatically when a scene is loaded.

   · Show Floating Ad In Scenes - In which scenes(levels) you want the Floating Ad to be shown as long as the scene is loaded.

[5] Okay, the integration is done here, to use the plugin, see below:

  Call the following functions to initialize and request an Ad:

   · LeadboltAd.Instance().Init(...) - Required if you don't apply "Section IDs" property value for LeadboltAdAgent.

   · LeadboltAd.Instance().LoadAd(...) - Load an Ad.

  There are other useful public methods that LeadboltAd provides, to use them, simply call LeadboltAd.Instance().methodName().
Show All   
public void Init(string secIdBanner, string secIdInterstitial, string secIdOverlay ... )
/**
 * Initialization, set the Leadbolt Section Id.
 * 
 * @param secIdBanner
 *            string - Your Banner Section ID.
 * 
 * @param secIdInterstitial
 *            string - Your Interstitial Section ID.
 * 
 * @param secIdOverlay
 *            string - Your Overlay Section ID.
 * 
 * @param secIdAppWall
 *            string - Your AppWall Section ID.
 * 
 * @param secIdInAppAlert
 *            string - Your InAppAlert Section ID.
 * 
 * @param secIdRichMedia
 *            string - Your RichMedia Section ID.
 * 
 * @param secIdFloating
 *            string - Your Floating Section ID.
 * 
 * @param secIdReengagement
 *            string - Your Reengagement Section ID.
 * 
 **/
public void Init(string secIdBanner, string secIdInterstitial,
	                 string secIdOverlay, string secIdAppWall, string secIdInAppAlert,
	                 string secIdRichMedia, string secIdFloating, string secIdReengagement)
public bool LoadAd(LeadboltAdType adType, bool hide = false)
/**
 * Load the Ad.
 * 
 * @param adType
 *         LeadboltAdType - The type of the Ad.
 * 
 * @param hide
 *         bool -   Whether the ad should keep being invisible after cached,
 *                  true for making the ad hidden, false for showing the 
 *                  ad immediately. if the parameter is set to true, then 
 *                  you need to programmatically display the ad by calling 
 *                  ShowAd() after you get notified with event
 *                  OnAdCached from LeadboltAdListener.
 */
public bool LoadAd(LeadboltAdType adType, bool hide = false)
public void ShowAd(LeadboltAdType adType)
/**
 * Show a hidden Ad.
 * 
 * @param adType
 *         LeadboltAdType - The type of the Ad.
 */
public void ShowAd(LeadboltAdType adType)
public void DestroyAd(LeadboltAdType adType)
/**
 * Destroy an Ad.
 * 
 * @param adType
 *         LeadboltAdType - The type of the Ad.
 */
public void DestroyAd(LeadboltAdType adType)
public void DisableAd()
/**
 * Disable all Ads.
 * 
 * This function is very useful when you want to disable the Ads after
 * the user makes an In-App Purchase. In this case, you should call
 * this function in OnPurchaseCompleted() event handler of an IAP
 * plugin. 
 * 
 * This function also persists the state on the user's device so you
 * don't need to set any variable in the PlayerPrefs.	
 */
public void DisableAd()
public void EnableAd()
/**
 * Enable Ads.
 * 
 * This function is for re-enabling the Ads after you called DisableAd().
 * After calling this function, you will be able to call LoadBannerAd() or
 * LoadInterstitialAd() then. And if the "Auto Load" switch is turned on, the
 * Ad will continue to be served then.
 * Persistent state is also taken care of, you don't need to set any variables
 * in the PlayerPrefs either.	
 */
public void EnableAd()
public void IsAdEnabled()
/**
 * Check if Ad is enabled or not.
 * 
 * This function is for getting the current state of the Ad.
 * 
 * @result bool - True if the Ad is enabled, false if the Ad has 
 *                been disabled by calling DisableAd().
 */
public bool IsAdEnabled()

[6] For advanced users who need to handle Ad events, read this:

  Follow the instructions to handle Ad events:

  · Select the dropped LeadboltAdListener gameObject, locate the LeadboltAdListener.cs script, open it and make some modifications.

  These callbacks are exposed in the script, you can supply your own implementations in them.
Show All   
void OnAdLoaded(LeadboltAdType adType) { ... }
/**
 * Fired when the Ad is loaded.
 */
void OnAdLoaded(LeadboltAdType adType)
{
    /// Your code here...   
}
void OnAdClicked(LeadboltAdType adType) { ... }
/**
 * Fired when the Ad is clicked.
 */
void OnAdClicked(LeadboltAdType adType)
{
    /// Your code here...
}
void OnAdClosed(LeadboltAdType adType) { ... }
/**
 * Fired when the Ad is closed.
 */
void OnAdClosed(LeadboltAdType adType)
{
    /// Your code here...
}
void OnAdCompleted(LeadboltAdType adType) { ... }
/**
 * Fired when the Ad is completed.
 */
void OnAdCompleted(LeadboltAdType adType)
{
    /// Your code here...
}
void OnAdFailed(LeadboltAdType adType) { ... }
/**
 * Fired when the Ad failed.
 */
void OnAdFailed(LeadboltAdType adType)
{
    /// Your code here...
}
void OnAdProgress(LeadboltAdType adType) { ... }
/**
 * Fired when the Ad is in progress.
 */
void OnAdProgress(LeadboltAdType adType)
{
    /// Your code here...
}
void OnAdAlreadyCompleted(LeadboltAdType adType) { ... }
/**
 * Fired when the Ad is already completed.
 */
void OnAdAlreadyCompleted(LeadboltAdType adType)
{
    /// Your code here...
}
void OnAdPaused(LeadboltAdType adType) { ... }
/**
 * Fired when the Ad is paused.
 */
void OnAdPaused(LeadboltAdType adType)
{
    /// Your code here...
}
void OnAdResumed(LeadboltAdType adType) { ... }
/**
 * Fired when the Ad is resumed.
 */
void OnAdResumed(LeadboltAdType adType)
{
    /// Your code here...
}
void OnAdCached(LeadboltAdType adType) { ... }
/**
 * Fired when the Ad is cached.
 */
void OnAdCached(LeadboltAdType adType)
{
    /// Your code here...
}

[7] Build your App now. To compile for iOS platform, you need to have Xcode installed.

[8] Test and verify if the Ad can show up as expected, don't forget to test if the Ad is clickable and if the Ad window can be opened. It is suggested that you should turn on Test Mode (Test Mode can be set in Leadbolt App Settings at Leadbolt website.) Also it would be helpful for you to address issues if you take a look at the logcat output (Android) or xcode debug console (iOS) to find the debug / error / warning messages.

[EOF] Should you have any questions or encounter any problems while integrating the plugin, please do not hesitate to shoot us an email at support@neatplug.com, we will be more than happy to help you. Thanks for choosing NeatPlug solutions!