The Mobile Advert plugin allows a game to use Admob Banner, Interstitial, Rewarded and Rewarded Interstitial adverts on Android and iOS exports.
Web exports use Google's Ad Placement API to show Interstitial and Rewarded adverts.
Construct supports the following advert types:
Follow these steps to quickly get started with Admob on mobile exports:
Follow these steps to quickly get started with adverts on web exports:
After sometime, hopefully your website will be approved and your game will be able to show ads.
In order for the Show User Consent Dialog action to show GDPR consent forms and IDFA messages (iOS only), it is required to set them up in your Admob account.
Follow this guide to Create a GDPR message
Follow this guide to Create an IDFA message
If you intend to show ads in mobile exports, either Android or iOS, you will need to specify your application IDs on the Mobile Advert object. Without these values the plugin will not be able to start.
If you intend to show ads in a web export, you will need to specify your publisher ID in the Mobile Advert object. Without that value, the plugin will not be able to show web adverts.
That's all the configuration you need for now. You can create new applications and edit your advert units later if you need.
The plugin will automatically initialize when the app starts. However this may involve showing a user consent prompt to the user for regulatory reasons, depending on the user's region. Therefore you should wait for the On configuration complete trigger to fire before attempting to create or show any ads. You should also use the On configuration failed trigger, and perhaps the Is configured condition, to check if configuration failed for any reason, such as being on an invalid platform or one of your properties being incorrect.
As of iOS 14+, the identifier for advertisers or IDFA is no longer available to apps by default. This can affect the performance of ads. To use the IDFA, you must prompt the user for permission to access it with the Request IDFA action. You may also wish to do this on startup. The On IDFA request complete trigger fires when the user makes a decision, and the IDFAStatus expression indicates the outcome.
In order to support the Request IDFA action, the Mobile Advert plugin includes an iOS library called App Tracking Transparency. To comply with Apple's App Store review process you may be required to indicate to the reviewers where your app uses the IDFA prompt. Therefore you may be required to add the Request IDFA action somewhere in your project. You do not have to always request it on startup - it could for example be a setting in a menu, and then you indicate to the App Store reviewers where to find the option.
Adverts need to load over the network before you can use them. When creating an advert you can choose to "show" the advert immediately after it has loaded. However if it's more suitable for your game you can choose to load your advert ahead of time by creating the advert, but not showing it, then later displaying the advert when you need it. This will prevent your user experiencing a lag while the advert loads. Be sure to check your advert has actually loaded before trying to display it, loading times for rewarded adverts in particular can be quite long. It's also worth remembering that you are not guaranteed to receive an advert when you request one, so take that into account when you are making your events.
To display a banner advert you must specify a size for it, generally smart portrait/landscape will work for most situations but here are the specifiable sizes. Using a size that is larger than the display will prevent it from loading. Smart banner will vary in height depending on the available screen height. With a smart banner if the base image isn't wide enough to fill the screen black bars are displayed on either side.
If you only want to show web ads, it is not necessary to provide ad units in your actions, the field can be left blank. If you are planning to use the same project for web and mobile though, you will still need to provide them.
There is a slight difference between rewarded ads in mobile and rewarded ads in web that should be considered.
In mobile when the ad is viewed you can use the RewardType and RewardValue expression to get information about the reward and this information is set in your Admob account through the ad unit.
In a web export, because you don't use ad units, the rewarded ads will always return the value "Reward" for the RewardType expression and the value of "1" for the RewardValue expression.
For this reason it is recommended to use the Platform Info plugin to decide what to do after a rewarded ad is viewed, depending on what platform the game is running on.