File: JVE.PubNative.pas Inheritance: TComponent ⬅ TJVEPubNative
File: JVE.MobFox.pas Inheritance: TComponent ⬅ TJVEMobFox
These components provide interfaces for PubNative and MobFox APIs for presenting native ads within a mobile application.
To present PubNative ads you will need to register at https://www.pubnative.net.
To present MobFox ads you will need to register at http://www.mobfox.com.
Each of the platforms above requires you to separately register the app, for each supported platform (currently this suite only support iOS and Android for advertising) and each provides a single ID for the app for each platform.
The platform is specified in a prefix “iOS” or “Android” of the name of the property. The properties thus defined are:
MobFox API features a demo key, which is supplied as the default value for the component; it could be used to test your app layout and integration. Notice also that you will not be able to test integration with your own key (i.e. inventory hash) before MobFox approves your app.
The list of properties, exposed by each component, is:
Both APIs are extremely similar in the parameters they accept and expose. The following properties are available in both components:
- UserGender – if (expected) gender of the user is known, set it here.
- UserAge – if the (expected) age of the user is known, use this property to set it.
- UserKeywords – list any known user’s interests in this property.
- UserLocation – if the current location of the user is known, it can be provided in this public (not published) property.
All these properties are optional, but providing their values might improve the quality of ads, effectively resulting in a higher level of revenues.
The following events are exposed by these components:
- OnAdAvailable – called when ad information was successfully retrieved from the server.
- OnError – called if an ad cannot be retrieved. You would usually log this error but not present it (unless showing the ad is mandatory n your app).
A single method is exposed by both components: RequestAd([Done]). When called without a parameter it starts the ad request; upon the request completion it calls either OnAdAvailable or OnError event (depending on the result).
If called with a callback parameter, the callback is called instead of the OnAdAvailable event. In case of failure, when calling with a callback, both the OnError event will be called and the callback will be called with nil instead of the ad data.
The ad data is represented by the TJVEAppDetails class (see List of Ads / Cross Promos section above), containing the following properties:
- Title, Description, Advertiser – textual description fields.
- CallToAction – a text for the button to open the ad (usually “Download” or “Install”).
- Rating – number of stars of rating (1-5 scale).
- Icon and Bitmap – an icon (square) and a banner (1:1.91 aspect ratio) of the ad.
- URL – the address to open when the user clicked the ad.
- Beacons – an array of addresses, which should be called, after the ad is presented.
It should be noted that these components are only available in mobile applications, so these components do nothing on other platforms (RequestAd simply calls OnError).