AdMob Bidding

👍

Full Technical Documentation

To get full documentation and samples please refer to the GitHub page.

Integration

Add the following lines to your project's Podfile

target 'Target' do
  project 'Project.xcodeproj'
  pod 'GoogleMobileAds-BidMachine-Adapters', '~> 1.7.1.0'
end

Initialization

🚧

Warning

Before AdMob SDK initialization, you should start the BidMachine SDK. All parameters for BidMachine SDK must be set before starting.

BDMSdkConfiguration *config = [BDMSdkConfiguration new];
    config.testMode = YES;

    config.targeting = BDMTargeting.new;
    config.targeting.storeURL = [NSURL URLWithString:@"https://storeUrl"];
    config.targeting.storeId = @"12345";

    [BDMSdk.sharedSdk startSessionWithSellerID:@"5"
                                 configuration:config
                                    completion:nil];

📘

Note

storeURL and storeId are required parameters

Your implementation of initialization should look like this:

BDMSdkConfiguration *config = [BDMSdkConfiguration new];
    config.testMode = YES;

    config.targeting = BDMTargeting.new;
    config.targeting.storeURL = [NSURL URLWithString:@"https://storeUrl"];
    config.targeting.storeId = @"12345";

    [BDMSdk.sharedSdk startSessionWithSellerID:@"5"
                                 configuration:config
                                    completion:^{

        [[GADMobileAds sharedInstance] startWithCompletionHandler:^(GADInitializationStatus * _Nonnull status) {
            NSDictionary *statuses = status.adapterStatusesByClassName;
            NSLog(@"%@", [statuses.allKeys componentsJoinedByString:@","]);
        }];
    }];

The example below shows the way to set all parameters.

BDMSdkConfiguration *config = [BDMSdkConfiguration new];

    config.baseURL = [NSURL URLWithString:@"https://baseURL"];
    config.testMode = YES;
    config.targeting = BDMTargeting.new;
    config.targeting.userId = @"userId";
    config.targeting.gender = kBDMUserGenderFemale;
    config.targeting.yearOfBirth = @(1990);
    config.targeting.keywords = @"keywords";
    config.targeting.blockedCategories = @[@"bcat1", @"bcat2"];
    config.targeting.blockedAdvertisers = @[@"badv1", @"badv2"];
    config.targeting.blockedApps = @[@"bapp1", @"bapp2"];
    config.targeting.country = @"country";
    config.targeting.city = @"city";
    config.targeting.zip = @"zip";
    config.targeting.storeURL =  [NSURL URLWithString:@"https://storeUrl"];
    config.targeting.storeId = @"12345";
    config.targeting.paid = YES;
    config.targeting.storeCategory = @"storeCat";
    config.targeting.storeSubcategory = @[@"subcat1", @"subcat2"];
    config.targeting.frameworkName = BDMNativeFramework;
    config.targeting.deviceLocation = [[CLLocation alloc] initWithLatitude:1 longitude:2];
    
    BDMSdk.sharedSdk.publisherInfo = [BDMPublisherInfo new];
    BDMSdk.sharedSdk.publisherInfo.publisherId = @"pubId";
    BDMSdk.sharedSdk.publisherInfo.publisherName = @"pubName";
    BDMSdk.sharedSdk.publisherInfo.publisherDomain = @"pubdomain";
    BDMSdk.sharedSdk.publisherInfo.publisherCategories = @[@"pubcat1", @"pubcat2"];
    
    BDMSdk.sharedSdk.restrictions.coppa = YES;
    BDMSdk.sharedSdk.restrictions.subjectToGDPR = YES;
    BDMSdk.sharedSdk.restrictions.hasConsent = YES;
    BDMSdk.sharedSdk.restrictions.consentString = @"consentString";
    BDMSdk.sharedSdk.restrictions.USPrivacyString = @"usPrivacy";
    
    BDMSdk.sharedSdk.enableLogging = YES;
    [BDMSdk.sharedSdk startSessionWithSellerID:@"5"
                                 configuration:config
                                    completion:nil];

📘

Note

storeId and storeURL are required. All other parameters are optional.

If you are using Header Bidding networks, then you need to set their parameters as follows.

All network-required fields and values types are described in BidMachine doc. If ad network has initialisation parameters, it should be added to the root of mediation config object. Ad-network ad unit-specific paramters should be added the root of ad unit object.

BDMSdkConfiguration *config = [BDMSdkConfiguration new];

    config.targeting = BDMTargeting.new;
    config.targeting.storeURL = [NSURL URLWithString:@"https://storeUrl"];
    config.targeting.storeId = @"12345";

    config.networkConfigurations = @[[BDMAdNetworkConfiguration buildWithBuilder:^(BDMAdNetworkConfigurationBuilder *builder) {
        builder.appendName(@"criteo");
        builder.appendNetworkClass(NSClassFromString(@"BDMCriteoAdNetwork"));
        builder.appendParams(@{@"publisher_id": @"XXX"});
        builder.appendAdUnit(BDMAdUnitFormatBanner320x50, @{ @"ad_unit_id": @"XXX" }, nil);
    }]];

    [BDMSdk.sharedSdk startSessionWithSellerID:@"5"
                                 configuration:config
                                    completion:nil];

Ad Format

Next, choose the ad format that best fits your app’s user experience.