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).

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.
  • At the bottom, enter your app id.
    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 action adapted to your ad unit. For example, if you created a banner, use the action to load a banner.
  • In the action, paste the ad unit id in the parameters. Because parameters are string expressions, you must put the ad unit identifier between quotes.

For example:

  • To display the ad as soon as it is ready, set “Display on Load complete” to 'Yes'.
  • While your account is not yet approved it is possible to view the space that the ad will take by activating the “Test Mode” to 'Yes'.

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 the 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:

  • Admob account need to be approuved.
  • Disable test mode
  • Set the app id, and ad unit identifier
  • Wait few hours-days before first ads.
  • Ads are not visible in preview, only in .apk
  • It may take a few days for the Admob service to provide ads to appear in your application, especially 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.