• English
  • Hindi
  • Bahasa
  • Vietnemese
  • Malay
  • Thai
Show Sidebar

Requesting Native Ads – Windows Phone 8 Unity Plugin

Native ads are ads which you can customize to match the unique user experience of your app.
Native ads can be requested in the following manner –

Once you initialize your plugin object, also ensure that you register for necessary events. i.e. DidCacheAd and FailedToCacheAd.

Once that has been done, now from OnGUI(), call the CacheAd() function and wait for the above registered events to occur.
Note: LoadAd() is not allowed for requesting Native ads. Using that will give an error message.

When you get a DidCacheAd event successfully, then get the contents of the Native Ad using the GetElementValue() API as shown here.

There are several elements to use for Native ads. All the constants for element keys can be found in NativeAdConstants class as static fields. You can use these constants to pass as keys to the function GetElementValue() as shown above.
You can also get an entire JSON string for the Native Ad elements using the API, GetContent(). Now, you have the entire json string which you can parse as per your need and utilize the values. But, however, the GetElementValue() API will give you all the necessary element values for keys mentioned in the NativeAdConstants class.
Once you get the necessary values, you can utilize them as you wish to show the Native Ad.

After showing the ad on the GUI, the first thing you need to do is call the API RegisterImpression(). This is a mandatory call. Else, if not called, it may result in revenue issues.
Note: Only after registering the impression the ad will be considered successfully rendered in application and impression will be recorded. Absence of calling this mandatory API on successful ad rendering will impact revenue so just ensure that you make a call to it as soon as the NativeAd gets loaded. The SDK will automatically prevent a duplicate impression from being recorded for a single request in case you hit this API multiple times.

Now, for handling the action when the Native Ad or its components are clicked, you can call the API CallToAction(). This will take the necessary action on user interaction with Native Ad components.

What would you like to do next?