Generated banner for Google Mobile Ads Banner
Generated logo for Google Mobile Ads Banner

Google Mobile Ads Banner

GoogleOfficialPublished by Google

  • Skill
  • Tool integration
  • Software development
  • Apache-2.0
  • No issues found

From the author

Provides instructions to implement, integrate, or configure Google Mobile Ads (GMA) banner ads in Android, iOS, or Unity mobile applications. Use when the task involves setting up banner ads in a mobile application. Don't use for other ad formats like interstitial or rewarded ads.
— the description by Google

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured workflow for integrating Google Mobile Ads (GMA) banner ads into mobile applications. It covers the setup process for Android, iOS, and Unity platforms, focusing on defining ad views, configuring adaptive ad sizes, and managing ad load events. The skill emphasizes the use of Large Anchored Adaptive Banners as the default standard and provides platform-specific guidance for handling ad requests and verifying implementation builds.

What it does

  • Identifies the target mobile platform (Android, iOS, or Unity).
  • Provides specific implementation steps for banner ad views and sizes.
  • Recommends Large Anchored Adaptive Banners as the default ad format.
  • Guides the registration of ad load event callbacks.
  • Includes platform-specific verification steps to ensure successful builds.
  • Reminds users to swap test ad unit IDs for production IDs.

When to use it

  • When you need to integrate banner ads into an Android, iOS, or Unity app.
  • When you are setting up adaptive banner layouts for mobile screens.
  • When you need to troubleshoot the initial configuration of a banner ad view.
  • When you require specific guidance on using the Google Mobile Ads SDK for banner formats.

Advantages

  • Standardizes the integration process across different mobile platforms.
  • Ensures best practices for adaptive banner sizing are followed.
  • Provides clear, step-by-step procedures to avoid common implementation errors.
  • Includes platform-specific verification methods to confirm successful integration.

Usage examples

“How do I add a banner ad to my Android app?”
The agent will identify the platform as Android, provide the necessary imports, guide you through defining the AdView, setting the adaptive AdSize, and implementing the loadAd callback while reminding you to handle UI threading correctly.
“I need to set up a banner in my iOS project.”
The agent will provide the steps to configure the BannerView, set the ad size using the appropriate global functions, and verify the build using xcodebuild or manual Xcode verification.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/google/google-mobile-ads-banner/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip google-mobile-ads-banner.zip -d .agents/skills

Documentation by Google

Google Mobile Ads SDK - Banner Ads

Banner ads are rectangular image or text ads that occupy a spot within an app's layout. They remain on screen during user interaction and can refresh automatically.

Banner Ad Types

Default to Large Anchored Adaptive Banner if the user says "banner" without defining a type. If the user suggests or asks about other banner ad types, recommend large anchored adaptive banners.

Banner TypeDescription
Large Anchored AdaptiveDefault. Can be anchored to the top or bottom of the screen.
Anchored AdaptiveCan be anchored to the top or bottom of the screen.
Inline AdaptiveONLY available to use for Android and iOS. Placed within content.

Workflow

  1. Determine the user's platform: Identify if the project is Android, iOS, or Unity. If unclear, ask before proceeding.

  2. Read the platform guide for implementation details:

    • Android: references/android-banner.md

    • iOS: references/ios-banner.md

    • Unity: references/unity-banner.md

  3. Follow these steps in order:

    • [ ] Define the ad view

    • [ ] Set the ad size

    • [ ] Register for ad load events

    • [ ] Load the banner ad

    • [ ] Verify the implementation

  4. After the banner ad is successfully implemented, remind the user to replace the test ad unit ID with their own.

Files

references/unity-banner.md

AI Integration Agent Instructions for Unity Banner Ads

Required Imports

Use the following imports to implement a banner ad:

using System;
using UnityEngine;
using GoogleMobileAds.Api;
using GoogleMobileAds.Common;

Banner Ad Workflow

  1. Define the ad view:

    Use the BannerView class from GoogleMobileAds.Api for defining banner ads. Set the appropriate test ad unit ID when creating the ad view:

    • Android anchored adaptive: ca-app-pub-3940256099942544/9214589741

    • iOS anchored adaptive: ca-app-pub-3940256099942544/2435281174

  2. Set the ad size:

    Pass AdSize.Banner or the appropriate adaptive ad size to the BannerView constructor along with AdPosition (AdPosition.Top or AdPosition.Bottom).

    For an anchored adaptive banner, use a large anchored adaptive ad size unless the user complains or a small height is needed.

    int width = MobileAds.Utils.GetDeviceSafeWidth();
    AdSize adSize = AdSize
        .GetCurrentOrientationLargeAnchoredAdaptiveBannerAdSizeWithWidth(width);
    BannerView bannerView =
        new BannerView(_adUnitId, adSize, AdPosition.Bottom);
  3. Register for ad load events:

    Subscribing to ad events on the BannerView object is optional and depends on your application requirements:

    • OnBannerAdLoaded: Subscribe to update UI state when the banner ad is ready and displayed.

    • OnBannerAdLoadFailed: Subscribe to log errors if the banner ad fails to load.

    • OnAdPaid: Subscribe to log estimated ad revenue (AdValue) for impression-level ad monetization tracking.

    • OnAdImpressionRecorded: Subscribe to track ad impressions in internal telemetry or third-party analytics platforms.

    • OnAdClicked: Subscribe to record user clicks on the ad.

    • OnAdFullScreenContentOpened: Subscribe to pause game audio, timers, or gameplay loops when the banner click opens full-screen destination content.

    • OnAdFullScreenContentClosed: Subscribe to resume game audio or gameplay loops when full-screen destination content is dismissed.

    CRITICAL: Whenever you provide code or instructions for Unity ads, you MUST explicitly state that background ad callbacks interacting with Unity objects (UnityEngine) must be scheduled on the main thread using MobileAdsEventExecutor.ExecuteInUpdate(), because Unity APIs are not thread-safe.

    bannerView.OnBannerAdLoaded += () =>
    {
        MobileAdsEventExecutor.ExecuteInUpdate(() =>
        {
            // Interact with UnityEngine objects on the main thread here.
        });
    };
  4. Load the banner ad:

    Call the LoadAd() method on the BannerView object passing a new AdRequest object (bannerView.LoadAd(new AdRequest())).

    bannerView.LoadAd(new AdRequest());
  5. Verify the implementation:

    Compile the Unity csproj file by running dotnet build. Resolve any GMA SDK related compile errors.

Additional documentation:

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Google
Publisher
Google (Official)
Source
google/skills · skills/ads/google-mobile-ads-banner · commit 2194d3b
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Google.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download google-mobile-ads-banner.zip