Skip to content

Ad Configuration

guillaumedebavelaere edited this page Nov 30, 2017 · 17 revisions

Setup

Ensure the Google Ad SDK is installed. It's also important to read the Google Ad Custom Targeting documentation as we will be using that below.

We will provide each of you with an Ad Unit ID to use in the Ad SDK configuration. See the Mediation section for details on how to handle your existing ad sources.

Page Templates, Positions and Sizes

To manage ad campaigns for multiple advertisers and app partners we need to standardise the ad sizes available. You need to create the ad views supporting these sizes below. Ensure that the view is centered and has an appropriate background colour to fill in any room next to the ads.

Page Template Position Mobile Size Tablet Size
General top 320x50 kGADAdSizeBanner 728x90 kGADAdSizeLeaderboard
content1 300x250 kGADAdSizeMediumRectangle 300x250 kGADAdSizeMediumRectangle
content2 300x250 kGADAdSizeMediumRectangle 300x250 kGADAdSizeMediumRectangle
Portfolio and
Confirmation
bot 320x50 kGADAdSizeBanner 728x90 kGADAdSizeLeaderboard
Trading bot 320x50 kGADAdSizeBanner 728x90 kGADAdSizeLeaderboard
Welcome bot 320x100 kGADAdSizeLargeBanner 728x90 kGADAdSizeLeaderboard
Link bot 320x50 kGADAdSizeBanner 728x90 kGADAdSizeLeaderboard

Page Targeting

Advertisers would like to be able to target individual pages. For that to work you will need to pass a pgtype key-value in the DFPRequest. You should select the value from the list below that is most appropriate for each of your screens:

  • homepage
  • watchlist
  • trading
  • portfolio
  • confirmation
  • welcome
  • link
  • general

If you are the TradeIt Swift SDK and TradeIt screens, it will already have this configured. If you are on the old SDK or have custom screens, you will need to add the ad views yourself to those screens.

Example

class HomeViewController: UIViewController {
    @IBOutlet weak var adView: DFPBannerView!

    override func viewDidLoad() {
        super.viewDidLoad()
        adView.adUnitID = "<AdUnitIDFromTradeIt>"
        adView.adSize = kGADAdSizeBanner
        adView.rootViewController = self
        let request = DFPRequest()
        request.customTargeting = [
            "pgtype": "homepage", 
            "pos": "top"
        ]
        adView.load(request)
    }
}

TradeIt SDK Screens

If you are using the TradeIt SDK screens, version 1.1.4 has the ads pre-built in to the screen. You need to update your Podfile with the following pods:

Installation

source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/tradingticket/SpecRepo'

target 'YourProjectTargetName' do
  use_frameworks!
  pod 'TradeItIosTicketSDK2', '~> 1.1.36'
  pod 'TradeItIosAdAdapterSDK', '~> 0.0.2'
end

Configuration

When you configure the TradeItSDK in your AppDelegate, attach the TradeItAdService using the adUnitId provided by TradeIt:

TradeItSDK.adService = TradeItAdService(adUnitId: "/24074087/TradeIt.Test1")

Mediation

There are 2 ways of handling mediation based on how much you want to manage:

TradeIt Mediation

If you provide us with your existing Ad Unit ID we can configure mediation through DFP so that you should always get an ad returned with your existing AdMob setup.

Custom Mediation

If you have other ad sources that aren't integrated with Google DFP or want to manage the mediation yourself, you are welcome to do so. You can use GADBannerViewDelegate and implement adView:didFailToReceiveAdWithError: to change the Ad Unit ID of the view and make another request.