2.1 KiB
2.1 KiB
title | page_status | see_also | |
---|---|---|---|
AdServer |
|
The Ad Server provides data used by the game to serve advertisements,
in form of an UI xml file (ads.xml
), an icon (ads-icon.png
)
and the full banner (ads-front.png
).
Details
Retrieving
To check for ads, the game sends an HTTP GET request for:
http://grannysmithgame.com/ads/ads.php?product={product}&platform={platform}&version={version}&rev={rev}
product
: most likely used to indicate if the game is afull
version or thefree
oneplatform
: platform that the game is on, for example androidversion
: game versionrev
: most likely an advertisement revision
The server responds with an zero length document if no advertisements are available. If there are any ads to show, then the server will respond with an xml document:
<ads revision="{revision}" showfront="{showfront}" onlyfree="{onlyfree}" sale="{sale}" folder="{folder}"/>
revision
: current advert revision. If zero, then none are available and no other field needs to be filledshowfront
: unknownonlyfree
: most likely used to show ads only to the users of Granny Smith Freesale
: unknownfolder
: a subfolder where advertisement files are stored.
Display
The advertisements use UI xml files and are shown when clicking the icon in the top-left corner of the screen.
Examples
Example response for an ad listing might look like this:
<ads revision="1" showfront="1" onlyfree="0" sale="0" folder="data"/>
For the following files:
http://grannysmithgame.com/ads/data/ads.xml
http://grannysmithgame.com/ads/data/ads-front.png
http://grannysmithgame.com/ads/data/ads-icon.png
Example ads.xml
file:
<ui texture="user://ads-front.png" selected="user://ads-front.png">
<outside cmd="script:hideads"/>
<!-- Note: you should change the width and height to banner image's dimensions -->
<rect coords="0 0 500 281" cmd="game.url https://grannysmithgame.com"/>
</ui>