This documentation provides a guideline for integrating BuzzAd Benefit into an iOS application. With its native format and high performance rewarded ads feature, BuzzAd Benefit can maximize publisher revenue without impairing the user experience.
Index
The below items are necessary to proceed with the integration:
Request the following to Buzzvil's BD manager
app_id
unit_id
Provide your postback url
to Buzzvil's BD manager
Postback API document (link)
Podfile
pod 'BuzzAdBenefit', '1.2.15' |
For satisfying the afnetworking4 or SDWebImage 5.X dependancy, apply below version.
pod 'BuzzAdBenefit', '1.2.15-afnetworking4' |
Via [Project] > [General] > [Embedded Binaries], add the following frameworks:
BuzzAdBenefit.framework
BuzzAdBenefitNative.framework
BuzzAdBenefitInterstitial.framework (for interstitial type)
BuzzAdBenefitFeed.framework (for feed type)
AFNetworking.framework
SDWebImage.framework
libwebp.framework
(AFNetworking.framework
, SDWebImage.framework
, libwebp.framework
can be downloaded from the Dependencies folder of this Github repository(link))
Via [Project] > [Build Phases], click +
button then add a New Run Script Phase
to paste the script provided below. This process is required to remove the unnecessary architecture in the binary resulted from building a universal framework.
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}" find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK; do FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable) FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME" EXTRACTED_ARCHS=() for ARCH in $ARCHS; do echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME" lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH" EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH") done echo "Merging extracted architectures: ${ARCHS}" lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}" rm "${EXTRACTED_ARCHS[@]}" echo "Replacing original executable with thinned version" rm "$FRAMEWORK_EXECUTABLE_PATH" mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH" done |
BuzzAdBenefit
Please add the following code under the application:didFinishLaunchingWithOptions
of the AppDelegate.
Insert app_id
in place of YOUR_APP_ID
// Objective-C BABConfig *config = [[BABConfig alloc] initWithAppId:YOUR_APP_ID]; [BuzzAdBenefit initializeWithConfig:config]; |
// Swift let config = BABConfig(appId: YOUR_APP_ID) BuzzAdBenefit.initialize(with: config) |
UserProfile
Please set the UserProfile
at the user login.
Note : User ID and targeting information (gender, birth year) is necessary for the proper functioning of BuzzAd Benefit. Ads are served only after the
setUserProfile
method is called.
userId : A unique identifier assigned to each user
Please consult with the BD manager if there is a possibility of userId
changing.
e.g.: userId
changes when a user reinstalls the app after deletion
gender
BABUserGenderMale
BABUserGenderFemale
birthYear
// Objective-C BABUserProfile *userProfile = [[BABUserProfile alloc] initWithUserId:YOUR_SERVICE_USER_ID birthYear:1985 gender:BABUserGenderMale]; [BuzzAdBenefit setUserProfile:userProfile]; |
// Swift let userProfile = BABUserProfile(userId: YOUR_SERVICE_USER_ID, birthYear: 1985, gender: BABUserGenderMale) BuzzAdBenefit.setUserProfile(userProfile) |
Note : Once session key registration is complete via Step 1 and 2,
BABSessionRegisteredNotification
is called. Without the session key, an API key needed to receive ads from the server, the SDK cannot load any ads. Therefore, if the time interval between Step 2 and the ad request is too short, the below procedure is required for session key registration.
// Objective-C [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loadBABAd) name:BABSessionRegisteredNotification object:nil]; |
// Swift NotificationCenter.default.addObserver(self, selector: #selector(loadBABAd), name: NSNotification.Name.BABSessionRegistered, object: nil) |
UserPreference
Please set the UserPreference
at the user login.
autoplayType: Configures video autoplay mode.
BABVideoAutoPlayEnabled
: Video autoplay is enabled
BABVideoAutoPlayOnWifi
: Video autoplay is enabled only on WiFi
BABVideoAutoPlayDisabled
: Video autoplay is disabled
// Objective-C BABUserPreference *userPreference = [[BABUserPreference alloc] initWithAutoPlayType:BABVideoAutoPlayEnabled]; [BuzzAdBenefit setUserPreference:userPreference]; |
// Swift let userPreference = BABUserPreference(autoPlayType: BABVideoAutoPlayEnabled) BuzzAdBenefit.setUserPreference(userPreference) |
Please remove the UserProfile
and the UserPreferences
upon user logout.
// Objective-C [BuzzAdBenefit setUserProfile:nil]; [BuzzAdBenefit setUserPreference:nil]; |
// Swift BuzzAdBenefit.setUserProfile(nil) BuzzAdBenefit.setUserPreference(nil) |
Please refer to the following link to finish the integration.
Native Ads : For exposing native ads that seamlessly blend with the in-app design
Feed Ads: For exposing list of ads on a feed
Interstitial Ads : For exposing interstitial ads using Buzzvil’s predefined layout