Skip to content
This repository was archived by the owner on Nov 7, 2023. It is now read-only.

Native Ads

Dominic Roberts edited this page Dec 4, 2017 · 7 revisions

Native Ads

Contents

1. Register a placement tag

For your app to receive any cross promo ads, the app must specify which CreativeTypes for each tag it uses when initialising the SDK.

// create a config
var config:TapdaqConfig = new TapdaqConfig(APPLICATION_ID, CLIENT_KEY);

// Setup the placements with ad types your app will use
var placements:Array = [
	new Placement([TapdaqCreativeType.SQUARE_SMALL],PlacementTag.MAIN_MENU)
];

// register placements in config
config.withPlacementTagSupport(placements);

// init Tapdaq ANE
_tapdaq = Tapdaq.init(config);

2. Load the native ad

First we have to load the native ad:

_tapdaq.loadNativeAd(TapdaqCreativeType.SQUARE_SMALL, PlacementTag.MAIN_MENU);

We should receive the TapdaqAdEvent.AD_LOADED event

3. Get the native ad

First we have to make sure we have the listener for the native ad data:

_tapdaq.addEventListener(TapdaqNativeAdDataEvent.AD_DATA, onNativeAdData);

And we can get the native ad data:

_tapdaq.getNativeAd(TapdaqCreativeType.SQUARE_SMALL, PlacementTag.MAIN_MENU);
private function onNativeAdData(event:TapdaqNativeAdDataEvent):void {
	_uiView.logInConsole("Tapdaq Native Ad event: ");
	_uiView.logInConsole("Ad::appName " + event.nativeAd.appName);
	_uiView.logInConsole("Ad::ageRating " + event.nativeAd.ageRating);
	_uiView.logInConsole("Ad::appVersion " + event.nativeAd.appVersion);
	_uiView.logInConsole("Ad::appSize " + event.nativeAd.appSize);
	_uiView.logInConsole("Ad::averageReview " + event.nativeAd.averageReview);
	_uiView.logInConsole("Ad::callToActionText " + event.nativeAd.callToActionText);
	_uiView.logInConsole("Ad::category " + event.nativeAd.category);
	_uiView.logInConsole("Ad::currency " + event.nativeAd.currency);
	_uiView.logInConsole("Ad::description " + event.nativeAd.description);
	_uiView.logInConsole("Ad::developerName " + event.nativeAd.developerName);
	_uiView.logInConsole("Ad::iconUrl " + event.nativeAd.iconUrl);
	_uiView.logInConsole("Ad::imageUrl " + event.nativeAd.imageUrl);
	_uiView.logInConsole("Ad::price " + event.nativeAd.price);
	_uiView.logInConsole("Ad::title " + event.nativeAd.title);
	_uiView.logInConsole("Ad::totalReviews " + event.nativeAd.totalReviews);


	var nativeAd:TapdaqNativeAd = event.nativeAd;

}

4. Sending the impression and click

When you display a Native Ad you should call triggerDisplay() on the received native ad for the impression to register:

nativeAd.triggerDisplay();

Within your touch listener for you Native Ad, you should call triggerClick() for the click action to occur, this will likely take the user to a webpage or Play Store.

nativeAd.triggerClick();

Need help?

If you are having any problems integrating, feel free to contact us on support@tapdaq.com and we will be more than happy to help.

What's next?

Now that you have successfully integrated a native ad into your app, what would you like to do next?

Clone this wiki locally