This API will provide an array of banners that are displayed in Y8 mobile games. This helps get more than one game on each device and build brand knownledge. To get started, ask your contact for the API link.
As each platform is different, we provide some psudo code below.
- You will need to download the json sent from that address.
- Then parse it into an object, usally something similar to
obj = JSON.parse(jsonString)
- Verify api was a success
- Find the ad type depending on the location
ads = obj.ad_types['Example 200x200']
There are multiple ads as they should be cycled through. For example, this 200x200 banner would go on a main menu maybe.
So we start at index 0
index = 0
Next time the main menu opens, add 1 to the index or loop around
if ads.length == index + 1 index = 0 else index++
Finally get your banner data
banner = ads[index]
Some banner images need to be resized down to fit with the display. One example, is a intro banner. A close button should be place at the top right.
This following button can be resized and placed as needed.