BuzzAd Benefit - iOS SDK Integration Guide
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
Getting Started
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 managerPostback API document (link)
Installation
1. Using Cocoapods (recommended)
Add the following line in Podfile
pod 'BuzzAdBenefit', '1.2.15'
For satisfying the afnetworking4 or SDWebImage 5.X dependancy, apply below version.
pod 'BuzzAdBenefit', '1.2.15-afnetworking4'
2. Manual Imports
1) Adding frameworks to the project
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))
2) Adding Run script
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
SDK Initialization
Step 1: Initializing the BuzzAdBenefit
Please add the following code under the application:didFinishLaunchingWithOptions
of the AppDelegate.
Insert
app_id
in place of YOUR_APP_ID
Step 2: Setting the 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
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.
Step 3: Setting the UserPreference
Please set the UserPreference
at the user login.
autoplayType: Configures video autoplay mode.
BABVideoAutoPlayEnabled
: Video autoplay is enabledBABVideoAutoPlayOnWifi
: Video autoplay is enabled only on WiFiBABVideoAutoPlayDisabled
: Video autoplay is disabled
Step 4. Removing the user settings
Please remove the UserProfile
and the UserPreferences
upon user logout.
Step 5. Proceeding to the next step
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