How to Set Up AdMob in Unity: A Complete Step-by-Step Guide

How to Set Up AdMob in Unity: A Complete Step-by-Step Guide

Google AdMob is the most popular way to monetize free mobile games, and Unity makes it relatively easy to integrate. In this guide you will learn how to set up AdMob in a Unity project from scratch: creating your AdMob account and ad units, installing the Google Mobile Ads Unity plugin, showing banner, interstitial and rewarded ads, and testing everything safely before you publish.

What You Need Before You Start

  • A Unity project that builds successfully for Android, iOS or both.
  • A Google AdMob account (free) linked to your Google account.
  • Your game's package name (Android) or bundle ID (iOS).
  • A test device and a few hours to integrate and test.

Step 1: Create Your App and Ad Units in AdMob

Sign in to the AdMob dashboard and choose Apps > Add app. Select the platform and tell AdMob whether the app is already published. If it is not on a store yet, you can link it later. AdMob then gives you an App ID, which looks like ca-app-pub-XXXXXXXXXXXXXXXX~YYYYYYYYYY. Keep it safe; the plugin needs it.

Next, create the ad units you plan to use. Most games use three formats:

  • Banner: a small rectangle at the top or bottom of the screen. Low revenue per impression, but always visible.
  • Interstitial: a full-screen ad shown at natural breaks, such as between levels.
  • Rewarded: a full-screen video the player chooses to watch in exchange for a reward, such as extra lives or coins. Rewarded ads usually earn the most and are the most player-friendly.

Each ad unit has its own Ad Unit ID with a slash, for example ca-app-pub-XXXXXXXXXXXXXXXX/ZZZZZZZZZZ. Create one per format and per platform.

Step 2: Install the Google Mobile Ads Unity Plugin

Download the latest Google Mobile Ads Unity plugin from Google's official GitHub releases page, or install it through OpenUPM if you prefer the package manager. In Unity, choose Assets > Import Package > Custom Package and import all files. The plugin includes the External Dependency Manager, which downloads the Android and iOS SDK dependencies for you.

After importing, open Assets > Google Mobile Ads > Settings and paste your Android and iOS App IDs into the fields. On Android, run Assets > External Dependency Manager > Android Resolver > Force Resolve so the required libraries are added to your project. If you see Gradle errors later, resolving again is usually the first fix to try.

Step 3: Initialize the SDK

Initialize the Mobile Ads SDK once, as early as possible, for example in a bootstrap or loading scene. A simple ads manager script can call MobileAds.Initialize() in Start() and then begin loading ads after initialization completes. Keep this script on a GameObject marked with DontDestroyOnLoad so it survives scene changes.

Step 4: Always Use Test Ads During Development

Never click your own live ads. AdMob can limit or disable accounts for invalid activity, even if it is accidental. During development, use Google's official test ad unit IDs, which are listed in the AdMob documentation for each format and platform, or register your phone as a test device in the AdMob dashboard. Only switch to your real ad unit IDs when you build the release version.

Step 5: Show a Banner Ad

Create a BannerView with your banner ad unit ID, a size such as AdSize.Banner or an adaptive size, and a position such as AdPosition.Bottom. Then load an AdRequest. Make sure the banner does not cover important buttons or gameplay elements; accidental clicks hurt user experience and can violate AdMob policies. Many developers hide the banner during active gameplay and show it on menus.

Step 6: Load and Show Interstitial Ads

Interstitials must be loaded before they are shown. Load the next interstitial in advance, then show it at a natural break, such as after a level ends or when the player returns to the menu. Good practice is to limit frequency, for example one interstitial every two or three levels or every couple of minutes, so players are not frustrated. After an interstitial closes, load the next one immediately.

Step 7: Add Rewarded Ads

Rewarded ads work best when the reward is clearly valuable and the choice is optional. Add a button such as "Watch an ad for +50 coins" or "Continue after game over". Load the rewarded ad in advance, show it when the player taps the button, and grant the reward only in the reward callback, not when the ad opens. Hide or disable the button when no ad is loaded so players never tap an empty button.

Step 8: Handle Consent and Privacy

If you serve ads to users in the European Economic Area, the UK or Switzerland, Google requires you to collect consent using a certified consent management platform. Google's User Messaging Platform (UMP) SDK is included with the plugin and handles the consent form. On iOS, you should also show Apple's App Tracking Transparency prompt before ads use the IDFA. Finally, list AdMob in your privacy policy and in the Google Play Data safety form. Our free Privacy Policy Generator includes the AdMob disclosure automatically.

Step 9: Add app-ads.txt

AdMob recommends publishing an app-ads.txt file on the developer website listed in your store listing. It tells advertisers that you are authorized to sell your ad inventory and can increase demand for your ads. AdMob shows the exact line to add in the app-ads.txt section of the dashboard.

Common AdMob Problems and Fixes

  • No ads showing: new ad units can take some time to start serving. Check that the App ID in the plugin settings matches the app, and test with test IDs first.
  • Build fails after importing the plugin: force resolve dependencies, make sure your target API level and Gradle versions are up to date, and remove duplicate libraries.
  • Low revenue: focus on rewarded ads, place interstitials at natural breaks and consider adding mediation networks once you have traffic.
  • Limited ad serving: this is usually temporary for new accounts or caused by invalid traffic. Never click your own ads or ask others to click them.

Final Checklist Before Publishing

  1. Real ad unit IDs are used in the release build, and test IDs only in development builds.
  2. Ads do not cover buttons or appear unexpectedly during gameplay.
  3. Consent is collected where required.
  4. Your privacy policy and Data safety form mention AdMob.
  5. app-ads.txt is published on your website.

If you want to skip the integration work, many projects in our Store come with AdMob already integrated, so you only need to replace the IDs with your own.

About the Author

AA
Abdullah Akasha
Project Manager, QA Lead & Editor at App Source Market

Abdullah is a computer science graduate who works with development teams to plan, test and ship websites and mobile projects. At App Source Market he builds the free developer tools and writes practical guides that help indie developers name, reskin, monetize and publish Unity and Buildbox games.

Our Research & Testing Process

Our guides are based on hands-on work with Unity, Buildbox and the Google Play and App Store consoles, and are checked against the official documentation at the time of writing. Each guide is reviewed for clear, step-by-step instructions and practical examples, and we update it when tools, store policies or requirements change.

Published: November 20, 2026Last Updated: November 20, 2026Meet Our Team →
Comments (0)
Login or create account to leave comments

We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies

More