-
First, you need to import Adform Advertising SDK to your project. Instructions on how to it you can find here.
-
Second, you need to import static library
libAdmobAdapterAdformAdvertising.a
to your project. Just drag the AdformAdvertisingDFPAdapter folder to your project. -
Then you have to configure banner or interstitial custom event in AdMob interface. More information on how to do so you can find here. There are two very important steps when defining a custom event:
- You must set master tag id provided by Adform in parameter field.
- You must use AdformCustomEventBanner class for inline ads and AdformCustomEventInterstitial class for interstitial ads (class name field).
That's it, you can try loading the ads now.
(Don't worry if ads are not loading straight away, it may need some time for AdMob servers to handle newly created custom event.)
Additionally you can pass key values and custom impression to
mediated Adform banners. To do so you have to use GADCustomEventExtras
class.
Create and instance of this class and set a NSDictionary with parameters.
When you are setting the extras you must make sure to use the same label as you
set in AdMob interface when creating a custom event.
NSDictionary may contain parameters for these keys:
kAFAKeyValuesKey
- use this key to set a NSDictionary with key value pairs.kAFACustomImpressionKey
- use this key to set a NSURL with custom impression.
GADPRequest *adRequest = [GADRequest request];
GADCustomEventExtras *extras = [GADCustomEventExtras new];
NSDictionary *parameters = @{kAFAKeyValuesKey: @{@"gender": @"male", @"age": @"25"},
kAFACustomImpressionKey: [NSURL URLWithString:@"http://your.custom.impression.com"]};
[extras setExtras:parameters forLabel:@"AdformCustomEventInterstitial"];
[adRequest registerAdNetworkExtras:extras];