Contents
- Introduction
- Set Up an AdMob Account
- Initialize Admob in Stencyl
- Displaying Banner Ads
- Displaying Interstitial ads
- Ads Events
- Other Ad Networks
- FAQ
Introduction
Although Android supports many ad networks, we've chosen to support AdMob, which is owned and operated by Google itself. Through 3rd-party extensions, Stencyl supports a number of other ad networks.
This guide is for Stencyl build 9279 and higher
Set Up an AdMob Account
Before you can test ads, in your game, you must set up an account with AdMob.
- Sign up for an account on AdMob's site.
- Provide the details they ask for (Tax Information, Personal Details, etc.)
- Monetise a new app for your game.
- Add your app manually or if its already in the store search for it and select your platform.
- Add App and take note of the App ID. You'll enter this into the Initialize Block in Stencyl.
- Select ad format and name ad unit. Stencyl is only supporting Banner and Interstitial ads at the moment.
- Save it and take note of th Ad unit ID (Also called Publisher Key on Stencyl Monetization page). You'll enter this into the Monetization page in Stencyl.
- Skip Firebase Firebase Analytics, this is not support by Stencyl.
- And your Finished
Initialize Admob in Stencyl
Now that you've set up an account with AdMob, you can test out ads in your game.
Enable Admob
- Open your game in Stencyl. Under Settings > Mobile > Monetization.
- Enable Admob ads
Enable Test Ads.
Before you publish your game to the store, you want to know if the ads are working. Google does not allow you to click on live ads when testing your game so you have to set Admob in Testmode.
- Open your game in Stencyl. Under Settings > Mobile > Monetization.
- Enable Test ads
Note: Don't forget to disable Test Ads when your are ready to Publish your game, or else the test ads will show up.
Enter in the AppId.
- Take note of your Admob AppId as mentioned above in step 4.
- Open your game in Stencyl. In palette under Game > Mobile you can find the Admob blocks.
- Fill in the AppId in the block, if your are using Banner Ads you can set here if you want it show at the top or at the bottom of your game.
Note: Use this block only once a session as early as possible(Like in a loading scene)
Displaying Banner Ads
Enter in the Ad unit ID
-
Take note of your AdMob Banner Ad unit ID as mentioned above in step 6. Als called Publisher key on Stencyl Monetization page
-
Open your game in Stencyl. Under Settings > Mobile > Monetization.
- Enter the Ad unit ID in AdMob Banner Android key
Displaying the Banner Ad
To display an ad, you must tell the ad to show. This is done using the show/hide ad block (under Game > Mobile). If you've read our iOS Ads guide, you'll notice that this is the same block.
Note: All the blocks that apply to iOS Ads also apply to Android Ads.
Controlling Ad Position
Ad Position is set in the Initialize block using the dropdown. You can choose between Top or Bottom positioning. If you want to change the position on runtime use the
Displaying Interstitial (Fullscreen) Ads
Enter in the Ad unit ID
-
Take note of your AdMob Interstitial Ad unit ID as mentioned above in step 6. Als called Publisher key on Stencyl Monetization page
-
Open your game in Stencyl. Under Settings > Mobile > Monetization.
- Enter the Ad unit ID in AdMob Interstitial Android key
Displaying Interstitial Ads
Before you can show the Interstitial ad, you have to load them first. (Its take a couple of seconds to load an ad). You have to load the ad every after it's showed up.
For example:
-
Load the ad when player click the start play button
- Show the ad when player ends his game, like when he is game over.
Ads Events
Sometimes, it's useful to know when an ad has been clicked on or dismissed, so that you can provide a smooth transition between viewing the ad and resuming the game. Stencyl provides the following events for ads.
These events can be found under the Mobile > Ads item under the Add Event dropdown.
Banner Ads Events
Event | Description |
---|---|
An banner ad is showing | The banner ad is showing on screen |
An banner ad is closed | User closes the banner ad |
The banner ad area loads | Called each time a banner ad loads |
The banner ad area fails to load | Called when no banner ads can be loaded |
An banner ad is clicked | User clicks on the banner ad |
Tip: We recommend pausing the game when an ad is clicked on and resuming it when the ad is dismissed. If you don't do this, the game will continue to run while the ad is overlayed over everything else.
Interstitial Ads Events
Event | Description |
---|---|
An fullscreen ad is showing | The Interstitial ad is showing on screen |
An fullscreen ad is closed | User closes the Interstitial ad |
The fullscreen ad area loads | Called each time a Interstitial ad loads |
The fullscreen ad area fails to load | Called when no Interstitial ads can be loaded |
An fullscreen ad is clicked | User clicks on the Interstitial ad |
Tip: We recommend pausing the game when an ad is clicked on and resuming it when the ad is dismissed. If you don't do this, the game will continue to run while the ad is overlayed over everything else.
Other Ad Networks
Officially, Stencyl only supports AdMob on Android. Through free, user-created extensions, other ad networks besides AdMob are supported. These include...
Check out our Extensions Market and Extensions Forum for more details.
FAQ
What version of the AdMob SDK is used?
As of late 2016, we're using v9.4 of Google play Services Library (SDK)
Tips
Avoid covering up the screen
When ads are displayed, they will cover up a small part of the screen. You should avoid displaying crucial game elements under an ad, such as HUD elements.
The height of mobile ad block (under Game > Mobile) provides the height, so you can lay your game out accordingly.
Print Article Edit Article How to Edit an Article12 Comments
The images on the page are not working, and I am unable to see where to put fill the AppId into the block as you describe? Would this be in the photo?
0
Has someone tried using Admob together with GlobalHop? As they say on their web page, it can work with any other SDK together.
0
When i activate the ads and then i test the game on an android device, the adds don't show
2
For your reference, builds based on the current SDK being used in admob (6.0) will no longer be supported from august 1st. Trying to raise a red flag in advance, support appreciated.
https://developers.google.com/mobil e-ads-sdk/docs/rel-notes
1
just an FYI, google has stated that it will stop supporting the legacy SDK based builds by august. the new admob IDS are working fine at the moment, but in august the legacy SDK based builds will no longer be acceptable at play (which will mean that if stencyls default admob plugin is based on the legacy SDK, our builds would not be acceptable). Kindly update if necessary, thanks, and if possible please confirm on thread (august is only 20 days away).
z
1
just migrated to the new admob (legacy admob shuts down aug 31st anyways). the publisher id format has changed. can we use the new format ID just like the old one? e.g. my games old legacy ID (the one that works) is a1531820524bce2
, but the new ID assigned by admob is ca-app-pub-6365002354052646/8477029 218. should i put this in without worrying?
1