VMAX
 
 
 
 
Show Sidebar

Requesting Native Ads – iOS SDK without Helper Libraries

Maaf, entri ini hanya boleh didapati dalam bahasa English. For the sake of viewer convenience, the content is shown below in the alternative language. You may click the link to switch the active language.

It is recommended to use the VMAX Helper Library. To request native ads via non helper methods, one needs to create a native ad view & conform as the native ad delegate as follows:

Objective-CSwift

Then one must request an ad via cacheAd as follows:

Objective-CSwift

Complete invocation code

Objective-CSwift

On caching success, the ‘adViewDidCacheAd’ callback is invoked using which, further customisation is possible as illustrated below:

Objective-CSwift

Using the VMaxNativeAd object, developers can further use the VMaxNativeAd elements to create custom native ads depending on their availability. The elements are further tabled in detail below.

Native Ad Display Precedence

It is recommended to display the key ‘central’ native ad elements by following the precedence as follows:

  1. Video ~ Recommended. If native ad contains vastVideoTag (via getVastVideoTag)
  2. Media View ~ if native ad partner is Facebook & native ad contains ‘view’ (via getView)
  3. Main Image ~ if native ad partner contains imageMain (via getImageMain)
  4. Medium Image ~ if native ad partner contains imageMedium (via getImageMedium)
  5. Description ~ if native ad partner contains description (via getDesc)

This allows for an immersive ad experience for the end user by ensuring display of native ad content based on the native ad element(s) availability, thus ensuring maximum visibility.

Native Ad Elements

Parameter Recommended Description
nativeAd.getTitle Yes the title property of the ad
nativeAd.getCtaText Yes the call to action title property of the ad
nativeAd.getDesc Yes the description property of the ad
nativeAd.getView Yes the view property of the ad; a dynamic view that is capable of displaying image or video e.g: media view in case of facebook
nativeAd.getImageIcon Yes the VMaxAdImage object created in response to the native ad containing an icon image
nativeAd.getImageIcon.image the image property of the icon object
nativeAd.getImageIcon.url the url of the image property of the icon object
nativeAd.getImageIcon.width the width of the image property of the icon object
nativeAd.getImageIcon.height the height of the image property of the icon object
nativeAd.getImageMain Yes the VMaxAdImage object created in response to the native ad containing a main image
nativeAd.getImageMain.image
nativeAd.getImageMain.url
nativeAd.getImageMain.width
nativeAd.getImageMedium the VMaxAdImage object created in response to the native ad containing a medium image
nativeAd.getImageMedium.image
nativeAd.getImageMedium.url
nativeAd.getImageMedium.width
nativeAd.getImageMedium.height
nativeAd.getImageMain.height
nativeAd.getImageBanner the VMaxAdImage object created in response to the native ad containing a banner image
nativeAd.getImageBanner.image
nativeAd.getImageBanner.url
nativeAd.getImageBanner.width
nativeAd.getImageBanner.height
nativeAd.getImageTile the VMaxAdImage object created in response to the native ad containing a tile image
nativeAd.getImageTile.image
nativeAd.getImageTile.url
nativeAd.getImageTile.width
nativeAd.getImageTile.height
nativeAd.getRating the rating property of the ad
nativeAd.getSalePrice the sale price property of the ad
nativeAd.getPrice the price property of the ad
nativeAd.getSponsored the sponsored property of the ad
nativeAd.getLikes the likes property of the ad
nativeAd.getPhone the phone property of the ad
nativeAd.getAddress the address property of the ad
nativeAd.getDesc2 the description property of the ad
nativeAd.getDisplayUrl the display url property of the ad
nativeAd.getDownloadss the downloads property of the ad
nativeAd.getNativeAdPartner the descriptive native ad partner name e.g: Facebook, AdMob, etc
nativeAd.getNativeAdType the type of the native ad e.g: Infeed, ContentStream, AppInstall, ContentAd etc
nativeAd.getLink the link property of the ad
nativeAd.getVastVideoTag the vast video xml markup property of the ad
nativeAd.getObjective the objective property of the ad

Additional notes for InMobi Native Ads

From InMobi version 6.0.0 (supported from VMAX iOS SDK v3.5.16), InMobi returns a ‘screenshots’ element on their dashboard as shown in the accompanying image.

inmobi_json

  • If you select an image with aspectRatio ‘1.91’, this is mapped to the ‘imageMain’ element of the Native Ad object. Thus, requesting for imageMedium will result in a nil value.
  • If you select an image with aspectRatio ‘1’, this is mapped to the ‘imageMedium’ & ‘imageTile’ elements of the Native Ad object. Thus, requesting for imageMain will result in a nil value.

As a best practice, you should always check if the requested element is nil or not and for non-nil, use the native ad element in rendering your custom native ad layout.

Ad Network Policies

In addition, you need to adhere to the policies shared by AdMob and Facebook here:

If using any ad network other that AdMob or Facebook, be sure to include an Ad symbol so that app users can identify that it’s an ad. The below example shows a test ad from VMAX having an icon, large image, title, CTA button and the ad attribution symbol in the top right.

 

image00

What would you like to do next?