lawicko lawicko - 1 year ago 103
iOS Question

AdSense adLayout parameter not working

I'm using Google-Mobile-Ads-SDK (7.8.1) to load some ads like this:

let bannerView = GADSearchBannerView(adSize:kGADAdSizeFluid)
bannerView.adUnitID = "pub-Super-Secret"
bannerView.frame = CGRectMake(0,0,CGRectGetWidth(self.advertismentContainer.bounds),0)
bannerView.autoresizingMask = .FlexibleWidth
bannerView.delegate = self
bannerView.adSizeDelegate = self

let request = GADDynamicHeightSearchRequest()
request.query = searchTerm
request.numberOfAds = 3
request.adTestEnabled = true
request.clickToCallExtensionEnabled = true

request.setAdvancedOptionValue("false", forKey:"domainLinkAboveDescription")
request.setAdvancedOptionValue("false", forKey:"sellerRatings")
request.setAdvancedOptionValue("false", forKey:"siteLinks")
request.setAdvancedOptionValue("sellerFirst", forKey:"adLayout")


I'm refering to the official documentation to find what parameters I can send. Sure enough, there is
parameter, which is exactly what I need:

By default, adLayout is disabled. If you wish to enable it, use this
line of code:

'adLayout' : 'sellerFirst'

Unfortunately, it comes with a star, but the star is never explained in the document I linked. I have tried to use the
layout, but it doesn't work. Is it possible to use this parameter in the iOS SDK? The ads load fine but the
parameter has no effect.

Answer Source

Turns out that there are 2 problems:

  • adLayout parameter needs to be enabled for the specific client-id, so if you want to use it you need to contact Google and ask them to enable it for you.
  • at the moment, this parameter is only available for the web clients, I was told that on iOS and Android it's still work in progress.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download