Skip to content

Banner ads

Marius Bughiu edited this page Feb 2, 2025 · 7 revisions

Displaying a banner ad

Add the controls namespace at the top of your page:

xmlns:admob="clr-namespace:Plugin.AdMob;assembly=Plugin.AdMob"

and then place the banner in your page.

<admob:BannerAd AdUnitId="ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx" />

Note

The AdUnitId is optional when using test ads. You can enable test ads by setting AdConfig.UseTestAdUnitIds to true.

Supported sizes

AdSize Width Height
SmartBanner Screen width 32/50/90
Banner 320 50
LargeBanner 320 100
MediumRectangle 300 250
FullBanner 468 60
Leaderboard 728 90
Custom * *

Custom size ad

You can also create banners with custom sized by specyfing AdSize="Custom" in combination with CustomAdWidth and CustomAdHeight. For example:

<admob:BannerAd AdSize="Custom" CustomAdWidth="200" CustomAdHeight="200" />