Skip to content

Commit

Permalink
docs: update gam-bidding-only-html-banner
Browse files Browse the repository at this point in the history
  • Loading branch information
OlenaPostindustria committed Feb 21, 2025
1 parent 39a626d commit 7e7d868
Showing 1 changed file with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ Integration example:
}
}
{% endcapture %}
{% capture gma11 %}

```swift
func createAd() {
{% capture gma11 %}func createAd() {
// 1. Create a BannerAdUnit using Prebid Mobile SDK
adUnit = BannerAdUnit(configId: CONFIG_ID, size: AD_SIZE)
adUnit.setAutoRefreshMillis(time: 30000)
Expand Down Expand Up @@ -75,7 +72,6 @@ func createAd() {
self?.gamBanner.load(gamRequest)
}
}
```

{% endcapture %}

Expand All @@ -85,7 +81,6 @@ If you want to support several ad sizes, you also need to implement `GADBannerVi

In case you use a single-size banner (e.g., 300x250), you don't need to make a call to the `AdViewUtils.findPrebidCreativeSize` routine because you already know the size of the creative. However, you still need to call `bannerView.resize` because the creative in GMA has a default size of 1x1, and without this call, it will be rendered as a pixel.

```swift
func bannerViewDidReceiveAd(_ bannerView: GADBannerView) {
// 6. Resize ad view if needed (Prebid Mobile SDK)
AdViewUtils.findPrebidCreativeSize(bannerView, success: { size in
Expand All @@ -95,7 +90,6 @@ func bannerViewDidReceiveAd(_ bannerView: GADBannerView) {
// The received ad is not Prebid’s one
})
}
```

{: .alert.alert-info :}
Make sure you process all possible cases in the `AdViewUtils.findPrebidCreativeSize` callbacks (both success and failure). Sometimes you might not get the size of the creative (or a failure callback) - it simply means that this is not a Prebid creative. It means that you still need to render the creative, but you most likely don’t need to resize it.
Expand Down Expand Up @@ -133,12 +127,10 @@ Ensure that you call the _load_ method with the same `GAMRequest` object that yo

Once an app receives a signal that an ad is loaded, you should use the method `AdViewUtils.findPrebidCreativeSize` to verify whether it's Prebid Server’s ad and resize the ad slot respectively to the creative's properties.

```swift
// GMA SDK functions
func validBannerSizes(for adLoader: GADAdLoader) -> [NSValue] {
return [NSValueFromGADAdSize(GADAdSizeFromCGSize(adSize))]
}
```

The function above provides valid banner sizes for the ad loader. Adjust it according to the size of your ad.

Expand Down

0 comments on commit 7e7d868

Please sign in to comment.