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 then be displayed as a banner at the top or bottom of the screen or they can be displayed as interstitial screens. Interstitial screens are ads that cover the entire device screen. You can also display reward videos.

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

1) 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”:

Then, 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, you can see your app id being displayed. You can note it now, but it will also be shown again at a later time in the process:

Next, choose whether you want to create the ad unit to display a banner, an interstitial screen or a reward video:

Here for example, we chose “Banner”. We then enter the name for this ad unit and click on “Create Ad Unit”:

When you are finished be sure to take note of the app id and the ad unit identifier:

The first identifier is the app id. The second is the ad unit identifier. Copy these identifiers or keep the page opened, you will need to insert them in the game properties and actions parameters to display the ads.

2) Set up your game

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

At the bottom, paste the app id:

Try not to be confused between the app id and the ad unit identifier. Here you need to enter the app id, which is unique for your app, while ad unit identifiers are different for each ad you're creating.

3) Use actions to load and display banner/interstitial screen/reward video

Once you have your game 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 Admob category:

You must choose the action adapted to your ad unit. If you created a banner, you have to use the action to load a banner.

In the action, paste the ad unit id in the parameters. As parameters are string expressions, you must put the ad unit identifier between quotes. For example:

Here is an example for banner:

  • Don't forget to set “Display on Load complete” to Yes to have the ad displayed as soon as it is ready.
  • You should start by setting “Test Mode” to Yes to test your ads before publishing your game.

4) Test and publish your game on Android (or iOS)

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

The one click packaging for Android service included with GDevelop is compatible with Admob, so you don't need any special tooling or development kit to install.

Example

You can try the ads and see how they work in a game by opening the example called AdMob. You can 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.