Native Type (iOS)

BuzzAd Benefit SDK: Native Ads


This documentation provides a guideline for integrating native ads for BuzzAd Benefit.

※ Note

Please proceed with the following process only after BuzzAd Benefit SDK integration is complete.

 

Index

 

Basic Usage


Step 1: Ad request with BABAdLoader

  1. Instantiate BABAdLoader

    • Insert unit_id in place of YOUR_NATIVE_AD_UNIT_ID

  2. Call loadAdWithOnSuccess:OnFailure



// Objective-C BABAdLoader *adLoader = [[BABAdLoader alloc] initWithUnitId:YOUR_NATIVE_AD_UNIT_ID]; [adLoader loadAdWithOnSuccess:^(BABAd * _Nonnull ad) { [self renderAd:ad]; // Refer to Step 3 } onFailure:^(NSError * _Nullable error) { // Handle error }];

 

// Swift let adLoader = BABAdLoader(unitId: YOUR_NATIVE_AD_UNIT_ID) adLoader.loadAdWith(onSuccess: { ad in self.renderAd(ad) // Refer to Step 3 }, onFailure: { error in // Handle error })

Step 2: Creating an ad layout

Create a layout for the ad components and link them to the relevant views.

 

  • Set BABNativeAdView as the root layout.

    • BABNativeAdView is a UIView component that corresponds to a single ad. Subcomponents for displaying an ad must be registered as children of this object.

  • The view responsible for showing the creative must include BABMediaView.

  • The layout can be flexibly freely through Interface builder (xib/storyboard).

 

Subcomponents

Component

Description

Size

Requirements

Required

Component

Description

Size

Requirements

Required

Media view

A creative (image or video)

1200x627 px

  • The aspect ratio should be kept

  • Padding can be added around the image

Y

Title view

The title of the ad

Max 25 characters

Ellipses can be used for omission over certain length

Y

Description view

A detailed description of the ad

Max 100 characters

Ellipses can be used for omission over certain length

Y

CTA view

  • Reward text view: Amount of point rewarded for opting in an ad

  • CTA text view: Phrase that drives the user action for the ad

Max 15 characters

Ellipses can be used for omission over certain length

Y

Icon image view

The advertiser's icon image

80x80 px

The aspect ratio should be kept

N

Sponsored 
image/ text view

A Text or an image indicating that it is an ad

-

Expose texts like Ad, Sponsored, etc.

N

 

Step 3: Constructing the layout with the BABAd

Draw an ad view using the BABAd received from the onSucess in Step 1.

  1. Set each ad property to the components created in Step 2.

  2. Set the MediaView and the ad to a NativeAdView.

  3. Create a clickableViews list to specify the areas where you want to make the ad clickable. Clicking the view area will lead to a landing page of an ad.


    // Objective-C - (void)renderAd(BABAd *ad) { // 1) self.titleLabel.text = ad.creative.title; // Description field exists as a default in objc self.descriptionLabel.text = ad.creative.body; [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:ad.creative.iconUrl]]; self.ctaLabel.text = [NSString stringWithFormat:@"+%d %@", (int)ad.reward, ad.creative.callToAction]; [self.rewardIcon setImage:[UIImage imageNamed:@"point_icon"]]; // 2) self.adView.ad = ad; self.adView.mediaView = self.mediaView; // 3) self.adView.clickableViews = @[self.ctaButton, self.iconImageView]; }



     

Step 4: Handling ad events via the BABNativeAdViewDelegate

Ad events can be handled by setting a delegate in the BABAdView (Refer to the document for event definitions and actions)

 

 

 

Advanced Usage


Loading multiple native ads

 

 

 

Handling the UI based on the user’s ad engagement

All ads served via BuzzAd Benefit SDK are rewarded ads. Each ad has “reward period”, a period of time required for users to earn extra reward for participating in the same ad, of 2 hours by default. Thus, there should be a UI displaying whether user is eligible for earning reward for the particular ad engagement.

For example, if the IPU (hourly impression per user) is set to be unlimited and the reward period is set to an hour, even with multiple engagement of the same ad, a user will receive reward only for the first engagement only in an hour. Thus, after the first engagement, a UI like “Already participated” or “0P” needs to displayed to the user.

 

  • Parameters to distinguish user’s ad engagement:

    • reward_status: If there is a history of user receiving reward in a reward period, “received” value is passed. (Note: even if reward_status is received, reward value remains the same)

    • is_participated: This parameter is to sync the engagement status of the currently allocated ads. When ad engagement occurs, the value of is_participated changes to true for all the same ads that have been allocated and onParticipate callback is called. (Note: even if ad is allocated with reward_status of received, until the user has an engagement with an ad is_participated stays false.)

  • Sample pseudo code