Integrating ads using Google AdMob

GDevelop supports integrating ads into your game using Google AdMob, on Android and iOS.

Ads can be loaded and displayed in your game at any time. They can be displayed as banners at the top or bottom of the screen, or displayed as interstitial screens. Interstitial screens are ads that cover the entire screen. Reward videos can also be displayed.

Banner ads are usually displayed during gameplay. Interstitial screens and reward videos are displayed after the completion of a level or an objective.

Setting up your Google AdMob account

To get started, go to AdMob website and create an account. Once that is done, you can create a new app and an ad unit.

Click on ''Apps“ then “Add App” in the left menu”.

Add your application by entering its name and choosing its platform. If your game is for both iOS and Android, you must register two ad units.

When created, your app id will be displayed.

Next, choose if the ad unit will be a banner, an interstitial screen or a reward video.

Enter the name for this ad unit and click on “Create Ad Unit”.

You will now see the app id and the ad unit identifier.

The first identifier is the app id. The second is the ad unit identifier. You need to know these identifiers to insert them in the game properties and actions parameters to display the ads. Copy them or leave the screen open.

Setup Payments in Admob

Before your ads can be displayed, you need to set up the payment method in your account. Go to the Payments page and fill in the necessary information:

When your account is ready, Admob will tell you so by showing that your account is approved:

Ads should now be able to be shown.

It can take a few hours (~4) for ads to show the first time. If ads are not showing, double check that you've entered all the necessary information in this page and that you properly configured your game (see next section).
When you accound is approved use the test mode for your test in local. If you use the production mode your account will be blocked because admob prohibits the use of advertisements on a local network. Use your 4G on phone or test mode. Your phone and computer should not be on the same network.

Setting up your game

Once you have created your AdMob account and have the app id and the ad unit identifier, open your game properties. Open the Project Manager, then click on Game settings and Properties.

In the AdMob section, enter your app id, one for Android and one for iOS (though it might be the same).

The app id must be entered without quotes.

Do not confuse the app id and the ad unit identifier. The app id is the unique id for your app, while ad unit identifiers are different for each ad you're creating.

Loading and displaying ads

Once your game is set up with the app id, you can add an event with an action to show the ad unit that you've created. All actions can be found inside the AdMob category:

Choose the actions adapted to your ad unit:

  • If you created a banner, use the action to 1) Configure the banner and 2) Show the banner.
    • For interstitials and rewarded videos, use the action to first load them (during the gameplay) and then the action to show them whenever you're ready (the player just finished a level for example).

    In the action, paste the ad unit id in the parameters (one for Android and one for iOS). Because parameters are string expressions, you must put the ad unit identifier between quotes.

To display the ad as soon as it is ready, activate the corresponding option. It's only for interstitials and rewarded videos. Banners are loaded and shown when loaded automatically using the Show banner action.

Finally, while your account is not yet approved it is possible to view the space that the ad will take by activating the “Test Mode”. This will present a fake banner, interstitial or rewarded video - this is a great way to test your actions.

For this, insert the action to enable the test mode at the beginning of your game:

Testing and publishing your game on Android (or iOS)

You must first build your game for Android (or iOS) to have the ads displayed on your device. See the page about Android and iOS publishing.

The one-click packaging for Android service included with GDevelop is compatible with Admob, so no additional tooling or development kits are needed.

In summary, before you launch your application with ads, you must:

  • Your Admob account needs to be approved.
  • Make sure to disable the test mode.
  • Double check that you have set the app id (for Android and iOS), and the ad unit identifiers (for Android and iOS).

Wait a few hours before seeing the first ads.

Remember that ads are not visible in the previews run in GDevelop, only in the exported Android (or iOS) app. It may take a few days for the AdMob service to start providing ads in your application, especially for video content.

Example

See how the ads work in a game by opening the example called AdMob. Replace the app id and the ad unit identifiers in the actions to test with your own account.

Try it online! Click here to open the Admob example. You must export to Android using the desktop app to test it on a real phone.