Latest | 1.0.3.0 |
---|---|
Homepage | https://github.com/appodeal/googleads-mobile-ios-bidmachine |
License | Apache License, Version 2.0 Copyright 2019 Appodeal, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
Platforms | ios 9.0 |
Dependencies | BidMachine, Google-Mobile-Ads-SDK |
Authors |
BidMachine adapter for AdMob
This folder contains mediation adapter used to mediate BidMachine.
Getting Started
Initialization parameters
To initialize BidMachine you can define your’s seller id in GADCustomEventExtras of bannerView and interstitial (also you can define parameters like test mode and logging that are set during initialization and define all parameters that can be used to set the targeting):
GADRequest *request = [GADRequest request];
GADCustomEventExtras *extras = [GADCustomEventExtras new];
NSDictionary *localExtras = @{
@"seller_id": @"2",
@"coppa": @"true",
@"logging_enabled": @"true",
@"test_mode": @"true",
@"userId": @"user123",
@"gender": @"F",
@"yob": @"2000",
@"keywords": @"Keyword_1,Keyword_2,Keyword_3,Keyword_4",
@"country": @"USA",
@"city": @"Los Angeles",
@"zip": @"90001–90084",
@"sturl": @"https://store_url.com",
@"paid": @"true",
@"bcat": @"IAB-1,IAB-3,IAB-5",
@"badv": @"https://domain_1.com,https://domain_2.org",
@"bapps": @"com.test.application_1,com.test.application_2,com.test.application_3",
@"priceFloors": @[@{
@"id_1": @300.06
}, @{
@"id_2": @1000
},
@302.006,
@1002
]
};
[extras setExtras:localExtras forLabel: @"BannerLable"];
[self.bannerView loadRequest:request];
Or you can set it from the AdMobUI in parameter string.
Test mode
To setup test mode in BidMachine add to GADCustomEventExtras @"test_mode" : @"true". You GADCustomEventExtras will be similar to what is shown below:
GADCustomEventExtras *extras = [GADCustomEventExtras new];
NSDictionary *localExtras = @{ @"test_mode": @"true" };
[extras setExtras:localExtras forLabel: @"BannerLable"];
Logging
To setup logging in BidMachine add @"logging_enabled" : @"true" flag to GADCustomEventExtras:
GADCustomEventExtras *extras = [GADCustomEventExtras new];
NSDictionary *localExtras = @{ @"logging_enabled": @"true" };
[extras setExtras:localExtras forLabel: @"BannerLable"];
Initialization
All parameters that are used during initialization are presented in table below:
Parameter | Type |
---|---|
Required | |
seller_id | String |
Optional | |
test_mode | String |
logging_enabled | String |
Transfer targeting data to BidMachine
If you want to transfer targeting information you can use custom event’s property localExtras which represents dictionary.
Keys for localExtras are listed below (Banner and Interstitial):
@"user_id" --> Vendor-specific ID for the user (NSString)
@"gender" --> User gender refer to OpenRTB 2.5 spec (kBDMUserGenderMale, kBDMUserGenderFemale, kBDMUserGenderUnknown)
@"yob" --> User year of birth (NSNumber)
@"keywords" --> Comma separated list of keywords about the app (NSString)
@"bcat" --> Blocked advertiser categories using the IAB content categories. Refer to List 5.1 (NSArray <NSString *>)
@"badv" --> Block list of advertisers by their domains (e.g., “ford.com”) (NSArray <NSString *>)
@"bapps" --> Block list of applications by their platform-specific exchange- independent application identifiers (NSArray <NSString *>)
@"country" --> User country (NSString)
@"city" --> User city (NSString)
@"zip" --> User zip code (NSString)
@"sturl" --> Store URL (NSURL)
@"stid" --> Numeric store id identifier (NSString)
@"paid" --> Paid version of app (NSNumber: 0-free, 1-paid)
Also you can transfer user location via extras. You can ad two more keys:
@"lat" - User's latitude (NSDouble)
@"lon" - User's longitude (NSDouble)
Banners implementation
In the snippet below you can see transfering of local extra data:
- (void)viewDidLoad {
[super viewDidLoad];
[self addBannerViewToView:self.bannerView];
// You can use test ad unit id - @"ca-app-pub-1405929557079197/7727940578" - to test banner ad.
self.bannerView.delegate = self;
self.bannerView.adUnitID = @"YOUR_AD_UNIT_ID";
self.bannerView.rootViewController = self;
}
- (IBAction)loadBanner:(id)sender {
GADRequest *request = [GADRequest request];
GADCustomEventExtras *extras = [GADCustomEventExtras new];
NSDictionary *localExtras = @{
@"seller_id": @"1",
@"coppa": @"true",
@"logging_enabled": @"true",
@"test_mode": @"true",
@"userId": @"user123",
@"gender": @"F",
@"yob": @"2000",
@"keywords": @"Keyword_1,Keyword_2,Keyword_3,Keyword_4",
@"country": @"USA",
@"city": @"Los Angeles",
@"zip": @"90001–90084",
@"sturl": @"https://store_url.com",
@"paid": @"true",
@"bcat": @"IAB-1,IAB-3,IAB-5",
@"badv": @"https://domain_1.com,https://domain_2.org",
@"bapps": @"com.test.application_1,com.test.application_2,com.test.application_3",
@"priceFloors": @[@{
@"id_1": @300.06
}, @{
@"id_2": @1000
},
@302.006,
@1002
]
};
[extras setExtras:localExtras forLabel: @"BannerLabel"];
[self.bannerView loadRequest:request];
}
But also you can receive extra data from server. It will be sent in (NSString *)serverParameter may look like this:
{
"seller_id": "1",
"coppa": "true",
"logging_enabled": "true",
"test_mode": "true",
"userId": "user123",
"gender": "F",
"yob": "2000",
"keywords": "Keyword_1,Keyword_2,Keyword_3,Keyword_4",
"country": "USA",
"city": "Los Angeles",
"zip": "90001–90084",
"sturl": "https://store_url.com",
"paid": "true",
"bcat": "IAB-1,IAB-3,IAB-5",
"badv": "https://domain_1.com,https://domain_2.org",
"bapps": "com.test.application_1,com.test.application_2,com.test.application_3",
"priceFloors": [{
"id_1": 300.06
}, {
"id_2": 1000
},
302.006,
1002
]
}
Interstitial implementation
With local extra data:
- (void)viewDidLoad {
[super viewDidLoad];
// You can use test ad unit id - @"ca-app-pub-1405929557079197/8789988225" - to test interstitial ad.
self.interstitial = [[GADInterstitial alloc] initWithAdUnitID:@"YOUR_AD_UNIT_ID"];
self.interstitial.delegate = self;
}
- (IBAction)loadInterstitial:(id)sender {
GADRequest *request = [GADRequest request];
GADCustomEventExtras *extras = [GADCustomEventExtras new];
NSDictionary *localExtras = @{
@"seller_id": @"1",
@"coppa": @"true",
@"logging_enabled": @"true",
@"test_mode": @"true",
@"ad_content_type": @"All",
@"userId": @"user123",
@"gender": @"F",
@"yob": @"2000",
@"keywords": @"Keyword_1,Keyword_2,Keyword_3,Keyword_4",
@"country": @"USA",
@"city": @"Los Angeles",
@"zip": @"90001–90084",
@"sturl": @"https://store_url.com",
@"paid": @"true",
@"bcat": @"IAB-1,IAB-3,IAB-5",
@"badv": @"https://domain_1.com,https://domain_2.org",
@"bapps": @"com.test.application_1,com.test.application_2,com.test.application_3",
@"priceFloors": @[@{
@"id_1": @300.06
}, @{
@"id_2": @1000
},
@302.006,
@1002
]
};
[extras setExtras:localExtras forLabel: @"InterstitialLabel"];
[self.interstitial loadRequest:request];
}
Servers extra data:
{
"seller_id": "1",
"coppa": "true",
"logging_enabled": "true",
"test_mode": "true",
"ad_content_type": "All",
"userId": "user123",
"gender": "F",
"yob": "2000",
"keywords": "Keyword_1,Keyword_2,Keyword_3,Keyword_4",
"country": "USA",
"city": "Los Angeles",
"zip": "90001–90084",
"sturl": "https://store_url.com",
"paid": "true",
"bcat": "IAB-1,IAB-3,IAB-5",
"badv": "https://domain_1.com,https://domain_2.org",
"bapps": "com.test.application_1,com.test.application_2,com.test.application_3",
"priceFloors": [{
"id_1": 300.06
}, {
"id_2": 1000
},
302.006,
1002
]
}
Rewarded implementation
With local extra data:
- (void)viewDidLoad {
[super viewDidLoad];
self.rewarded = [[GADRewardBasedVideoAd alloc] init];
self.rewarded.delegate = self;
}
- (IBAction)loadRewarded:(id)sender {
GADRequest *request = [GADRequest request];
GADBidMachineNetworkExtras *extra = [GADBidMachineNetworkExtras new];
[extra setSellerId:@"1"];
[extra setCoppa:NO];
[extra setLoggingEnabled:YES];
[extra setTestMode:YES];
[extra setHasUserConsent:YES];
[extra setConsentString:@"some_consent_string"];
[extra setIsUnderGDPR:NO];
[extra setUserLatitude:12.34];
[extra setUserLongitude:56.78];
[extra setUserId:@"some_user_id"];
[extra setGender:@"F"];
[extra setYearOfBirth:@1996];
[extra setKeywords:@"Keyword_1,Keyword_2,Keyword_3,Keyword_4"];
[extra setCountry:@"USA"];
[extra setCity:@"Los Angeles"];
[extra setZip:@"90001–90084"];
[extra setStoreURL:[NSURL URLWithString:@"https://store_url.com"]];
[extra setStoreId:@"123123"];
[extra setPaid:NO];
[extra setPriceFloors:@[@{
@"id_1": @300.06
}, @{
@"id_2": @1000
},
@302.006,
@1002
]];
[extra setBlockedCategories:@[@"IAB-1", @"IAB-3", @"IAB-5"]];
[extra setBlockedAdvertisers:@[@"https://domain_1.com", @"https://domain_2.org"]];
[extra setBlockedApps:@[@"com.test.application_1", @"com.test.application_2", @"com.test.application_3"]];
[request registerAdNetworkExtras:extra];
// You can use test ad unit id - @"ca-app-pub-1405929557079197/1031272924" - to test rewarded ad.
[self.rewarded loadRequest:request withAdUnitID:@"YOUR_AD_UNIT_ID"];
}
Servers extra data:
{
"seller_id": "1",
"coppa": "true",
"logging_enabled": "true",
"test_mode": "true",
"userId": "user123",
"gender": "F",
"yob": "2000",
"keywords": "Keyword_1,Keyword_2,Keyword_3,Keyword_4",
"country": "USA",
"city": "Los Angeles",
"zip": "90001–90084",
"sturl": "https://store_url.com",
"paid": "true",
"bcat": "IAB-1,IAB-3,IAB-5",
"badv": "https://domain_1.com,https://domain_2.org",
"bapps": "com.test.application_1,com.test.application_2,com.test.application_3",
"priceFloors": [{
"id_1": 300.06
}, {
"id_2": 1000
},
302.006,
1002
]
}
Latest podspec
{ "name": "GoogleMobileAds-BidMachine-Adapters", "version": "1.0.3.0", "summary": "BidMachine IOS adapter for GoogleMobileAds mediation", "description": "Supported ad formats: Banner, Interstitial, Rewarded Video.", "homepage": "https://github.com/appodeal/googleads-mobile-ios-bidmachine", "license": { "type": "Apache License, Version 2.0", "text": " Copyright 2019 Appodeal, Inc.nLicensed under the Apache License, Version 2.0 (the "License");nyou may not use this file except in compliance with the License.nYou may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0nUnless required by applicable law or agreed to in writing, softwarendistributed under the License is distributed on an "AS IS" BASIS,nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.nSee the License for the specific language governing permissions andnlimitations under the License.n" }, "authors": { "Appodeal": "http://www.appodeal.com" }, "platforms": { "ios": "9.0" }, "source": { "git": "https://github.com/bidmachine/googleads-mobile-ios-bidmachine.git", "tag": "v1.0.3.0" }, "source_files": "BidMachineAdapter/**/*.{h,m}", "static_framework": true, "dependencies": { "BidMachine": [ "1.0.3" ], "Google-Mobile-Ads-SDK": [ "7.44.0" ] } }
Thu, 30 May 2019 10:04:05 +0000