Please be sure to read CrazyGames’ advertisement requirements, since your game will be rejected without any feedback if it doesn’t follow them.
The banner module contains functionality for displaying banners in game.
To begin, you need to have an HTML container of the banner size present on the screen. The extension will automatically add one to the bottom of your screen with id banner-container
. If you need more than one banner or wish to position the banner differently it is possible to do so by using a custom HTML5 page template.
Available sizes are:
crazygames.request_banner("banner-container", 728, 90)
Note: You can have no more than 2 banners of the same size in your game.
The responsive banners feature will request ads that fit into your container, without the need to specify or select a size beforehand. The resulting banners will have one of the following sizes: 970x90, 320x50, 160x600, 336x280, 728x90, 300x600, 468x60, 970x250, 300x250, 250x250 and 120x600. Only banners that fit into your container will be displayed, if your container cannot fit any of these sizes no ad will be rendered. The rendered banner is automatically vertically and horizontally centered into your container.
Your container size must be set to a non-null value:
<div id="responsive-banner-container" style="width: 500px; height: 500px"></div>
crazygames.request_responsive_banner("banner-container")
To refresh the banners, simply call the request_banner
or request_responsive_banner
functions again with the same container id.
The banners have the following limitations:
The SDK provides 2 methods for clearing the banners:
crazygames.clear_banner("banner-container")
-- or
crazygames.clear_all_banners()
CrazyGames recommend that you clear the banners after hiding them. Otherwise, when you request new banners again, the old banners may still appear for a fraction of a second, which negatively impacts the user experience.
Did you spot an error or do you have a suggestion? Please let us know on GitHub!
GITHUB