Skip to content

Advertising

Sergio Azua edited this page Jan 5, 2016 · 25 revisions

Summary

The Advertising module allows use of Bazaarvoice's powerful shopper segment data with Google Mobile Ads. The BVAdvertising is architected so that you can use all aspects of the DFP (Doubleclick For Publishers) SDK easily, with Bazaarvoice's shopper segment functionality built in.

Configure the Advertising Module:

App Gradle - Add dependencies

Include Maven Central repository and add Common and Recommendations modules to dependencies

dependencies {
    compile 'com.bazaarvoice.bvandroidsdk:common:3.0.0'
    compile 'com.bazaarvoice.bvandroidsdk:advertising:3.0.0'
}
repositories {
    mavenCentral()
}

###Java - Extend Application Create a class that extends android.app.Application and initialize the SDK

public class BVApplication extends Application {

    @Override
    public void onCreate()
    {
        super.onCreate();
        //initialize BVSDK
        BVSDK.init(this, "yourClientId", BazaarEnvironment.production);
    }
}

Set User Information

Once a user is authenticated inside your user login workflow, set user information inside the BVSDKManager sharedManager object.

NOTE: The userAuthString created with your existing Bazaarvoice implementation logic needs to be given to the BVSDKManager sharedManager object. However, the steps to encrypt your userAuthString are still applicable even if you are not a Conversations client.

Instantiating the Ads SDK

The Ads SDK must be instantiated with your valid Bazaarvoice Shopper Advertising API key. For optimal performance manage a single instance at a time. Below is an example of how to instantiate the Ads component:

import com.bazaarvoice.bvandroidsdk.Ads;

public class MainActivity extends Activity {
    Ads ads;

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ads = new BVAds("YOUR_API_KEY");
    }
}

Adding information about the user

The user auth string is an encrypted query string. In the documentation above, date=2007­0527&userid=ID12345 is used as an example. This is then encrypted/signed appropriately, for security. You should add information (such as identity, demographics) in this query string, for example: date=2007­0527&userid=ID12345&facebookId=abc123&age=28&gender=female. Allowed keys (*userid,age, email, facebookId, gender, twitterId) are defined in SomeFile.java. This information can then be safely passed to an Ads instance like below:

Example Auth String - for testing purposes

This user below interested in "pets", "powersports", "gamefish" and others. See the Contextual Interests section below for further explanation. Following the example above:

ads.setUserWithAuthString(aa05cf391c8d4738efb4d05f7b2ad7ce7573657269643d4f6d6e694368616e6e656c50726f66696c65313226656d61696c3d6a61736f6e406a61736f6e2e636f6d);

Once setUser has been called, Bazaarvoice's back-end systems will begin matching data to this user's profile. This process is near real-time, but not instant. The SDK will poll to update the user profile and should reflect the user's interests within seconds.


Google Mobile Ads

Google Mobile Ads SDK is included within this sdk. BVAdvertising subclasses Google's various classes to provide correct user personalization, while still leaving all of Google Mobile Ads SDK power in your hands.
Full details on implementing Google Mobile Ads in iOS can be found here.

Targeted Ads

Targeted ads must be setup in Doubleclick For Publishers (DFP). Contact Bazaarvoice about setting up targeted ads in DFP. Replace the adUnitId's below with the adUnitId provided to you.

Serving Native Ads with BVAdvertising

See DFP's documentation on implementing native ads which explains the entire process in detail. It is very important to follow DFP's implementation guide to properly implement native ads.

#TODO
During implementation, use BVTargetedAdLoader and BVTargetedRequest instead of using GADAdLoader and DFPRequest.

A working example is provided in the example project (NativeDemoViewController.m) and summarized below:

#import <BVSDK/BVAdvertising.h>
// . . .
@interface NativeDemoViewController()<GADNativeContentAdLoaderDelegate>
// . . .
@property BVTargetedAdLoader* adLoader;
// . . .
self.adLoader = [[BVTargetedAdLoader alloc]
                    initWithAdUnitID:@"/6499/example/native" //Test adUnitId. Replace with your targeted adUnitId.
                    rootViewController:self
                    adTypes:@[ kGADAdLoaderAdTypeNativeContent ] 
                    options:nil];
        /* possibly any combination of : kGADAdLoaderAdTypeNativeContent, kGADAdLoaderAdTypeNativeCustomTemplate, kGADAdLoaderAdTypeNativeAppInstall */
    
    [self.adLoader setDelegate:self];
    BVTargetedRequest* request = [self.adLoader getTargetedRequest];
    [self.adLoader loadRequest:request];
// . . .
#pragma mark - GADNativeContentAdLoaderDelegate
- (void)adLoader:(GADAdLoader *)adLoader didReceiveNativeContentAd:(GADNativeContentAd *)nativeContentAd {
    [self showAd:nativeContentAd];
}
Serving Banner Ads with BVAdvertising

See DFP's documentation on implementing Banner Ads which fully explains the process. It is very important to follow DFP's implementation guide to properly implement banner ads.
During implementation, use BVTargetedBannerView instead of using DFPBannerView.

A working example is provided in the example project (BannerDemoViewController.m).

Serving Interstitial Ads with BVAdvertising

See DFP's documentation on Interstitial Ads which explains the entire process of creating an interstitial ad. It is very important to follow DFP's implementation guide to properly implement interstitial ads.
During implementation, use BVTargetingInterstitial instead of using DFPInterstitial.

A working example is provided in the example project (InterstitialDemo.m).


Contextual Interests

BVAdvertising is structured around categories that products belong to. The list is fully defined in BVContextualInterests.h. It is split into two tiers, with about 30 tier one categories, all with multiple sub-categories (tier two).
For example, the Women's dresses section of a Target store would correspond to:

  • tier one: tierOneApparelAndAccessories
  • tier two: tierTwoApparelAndAccessoriesWomensDresses

Similarly, the Television section of a BestBuy store would correspond to:

  • tier one: tierOneConsumerElectronics
  • tier two: tierTwoConsumerElectronicsTelevisions

NOTE: All tier two categories are extensions of their tier one category names. Contextual Interest categories are used while sending location information to BVAdvertising, as defined below.


BVAdvertising + User Location

BVAdvertising provides many ways to integrate location data into a shopper's profile.
All location related methods can be found in BVLocationEventsHelper.h, but a couple notes:

  • All location methods have contextualTier1 and contextualTier2 parameters. This allows you to send all location->interest mapping information available to BVAdvertising in order to give the shopper the best profile possible. See BVContextualInterests.h for a generated list of Contextual Tier 1 and Tier 2 strings.
  • We define methods that correlate strongly to CLLocationManagerDelegate methods -- and provide an example usage of CLLocationManager+BVAdvertising inside the LocationExample file.
  • We also define methods that correlate strongly to Gimbal Beacon delegate methods, specifically GMBLPlaceManagerDelegate and GMBLBeaconManagerDelegate. Similarly, we provide an example usage of Gimbal+BVAdvertising in the GimbalExample file.