Adding Google Admob Ads to your Unreal Engine Android & iOS Apps | with Test Ads setup (Blueprint)

Codeible
6 min readApr 5, 2023

--

Hello, in this tutorial, I’ll show you how to use the AdMob Blueprint Plugin for Unreal Engine to place ads on your app.

Follow on Twitter: Codeible (@codeible) / Twitter.

Documentations

Setup & Test Ads

Creating a Banner Ad

Creating an Interstitial Ad

Creating an Rewarded Ad

Packaging your project

Installing the Plugin

  1. To begin, go to the Unreal Engine Marketplace. Search for Admob Blueprint and install the plugin.
Codeible.com — Installing Plugin Image

2. Now go to console.firebase.google.com in your favorite browser.

3. Sign in with your Google Account or create one if you don’t have one already.

4. Create a New Project or use an existing one.

Codeible.com — Firebase Console

5. Click on the Gear Icon on the navigation menu and select Project settings.

Codeible.com — Project Settings

6. If you want to show ads on Android, click on the Android icon. If you want to show ads on iOS, click on the iOS icon.

If you plan to deploy your app on Android and iOS, you’ll need to do both.

Codeible.com — Icons

Android Setup

  1. Insert the package name for your app. Make sure it matches your app or your real ads from AdMob will not show and you’ll not be able to package your app.

For testing, use this package name com.ue.admob.blueprint.plugin

Codeible.com — Android Package Name

2. Now click on Register app to start the project creation.

3. On the next step, download the google-services.json file and click next until you reach the last step.

4. Click on Continue to console.

5. Now that you have the google-services.json file, you can begin adding ads to your app. Locate your Unreal Engine project and put the google-services.json file into the root directory.

Codeible.com — Android Root Dir

6. Now open your Unreal Engine app and open the Plugins window.

7. Search for Admob Blueprint and add it to your project.

Codeible.com — Install Plugin

8. Once you have the plugin installed, open the Project Settings window, and look for the Android menu on the left under Platforms.

Codeible.com — Android Platform Menu

9. Configure your project for Android.

Codeible.com — Configure for Android

10. Then change the package name to match the one on Firebase.

Codeible.com — Android Package Name Change

11. Now go to the Plugin Documentation for the setup and locate the meta-data code snippet.

12. Copy it and scroll until you find the Advanced APK Packaging section. In the Extra Settings for Application section. Paste the code inside the text box.

Codeible.com — Andoid Meta-data

The App ID is a test id, so you’ll need to place your own approved AdMob App id for your own ads.

Now you’re ready to show ads on Android

IOS Setup

  1. Now for iOS, create a new iOS app on Firebase.
Codeible.con — IOS Create

2. Put the Bundle ID for your app.

Make sure it matches the bundle id you have on Apple Developer and Unreal Engine.

For testing, use this package name com.ue.admob.blueprint.plugin

Codeible.com — IOS Bundle ID

3. Click on Register app to start the app creation.

4. Click on Download GoogleService-info.plist and download the plist file and keep clicking next until you reach the last step.

5. Click on Continue to console to complete the process.

6. Locate your Unreal Engine project and put the googleservices-info.plist file into the root directory.

Codeible.com — IOS Root

7. Now open your unreal engine app and open the Plugins window. Search for Admob Blueprint and add it to your project.

Codeible.com — IOS Plugin

8. Once you have the plugin installed, open the Project Settings window, and look for the iOS menu on the left under Platforms.

Codeible.com — IOS Platform

9. Change the Bundle Identifier to match the one in Apple Developer and Firebase. Then select your provisions and certificate.

Codeible.com — IOS Bundle Id

10. Scroll until you find the Additional Plist Data section and go to the plugin documentation for the setup. Scroll until you find the example plist info and copy it.

Codeible.com — Additional PLIST

Creating Banner Ads

  1. Open the level blueprint.
  2. Call Event Begin Play and then initialize google mobile ads by using the Initialize Google Mobile Ads node.
Codeible.com — GMA Init

You’ll just need to initialize it once so you should do it in the Game Instance. For the tutorial, I’ll do it in the level blueprint.

It has 2 callbacks. One will get executed when the initialization was successful and the other one gets executed when something failed.

3. Click and hold on to them, then drag on an empty spot. Select Add Event, then Add Custom Event.

Codeible.com — Add Init Events

4. To create banner ads, use the Create Banner Ad node.

Codeible.com — Create Banner Ad

Then place the Ad Unit id from your Admob console. For testing, use this test Banner Ad id.

ca-app-pub-3940256099942544/6300978111

5. For the size, you can select from the list. Experiment with each to find the right size for your app.

6. For the position, you can choose from a list as well.

7. When you have your ad, use the Load Ad node to put ads into the banner.

Codeible.com — Load Ad Node

Ads will automatically refresh so you do not need to keep using it to load new ads.

It also has 2 callbacks, one for success and one for fail.

8. When ads are loaded, use the Show Ad node to display the ad.

Codeible.com — Show Ad

There is only one callback for the node, so we’ll know if it failed.

Now when you launch your app on the phone, the ad should show.

Creating Interstitial Ads

The process is the same for interstitial ads.

  1. Instead of using Create Banner Ad, use the Create Interstitial Ad node.
  2. Then put the interstitial Ad Unit Id from Admob.

To testing, use this test ad id:

ca-app-pub-3940256099942544/1033173712

Codeible.com — Interstitial Ad

That’s all for this tutorial. Thanks for reading.

--

--