adConfig

The adConfig() call communicates the game's current configuration to the Ad Placement API. The Ad Placement API can use this to tune the way it preloads ads and to filter the kinds of ads it requests so they're suitable (eg. video ads that require sound).

Function signature:

adConfig({
   preloadAdBreaks: 'on|auto',  // Ad preloading strategy
   sound: 'on|off'              // This game has sound
   onReady: () => {},           // Called when API has initialised and adBreak() is ready
});

adConfig parameters

Name Type Description
sound string (OPTIONAL) Whether the game is currently playing sound. Values:
- on (default)
- off
This call specifies whether your game is capable of sound, and whether the sound was enabled (ie unmuted) before the call to adBreak(). This helps the Ad Placement API to select the right kind of ad for your game.
Call this function as soon as the sound state of your game changes, as the Ad Placement API may have to request new creatives, and this gives it the maximum amount of time to do so.

The default value is sound on. So most games will need to make a call to adConfig() when they start to declare that they have sound enabled.
preloadAdBreaks string (OPTIONAL) Whether ads should always be preloaded before the first call to adBreak(). Values:
- on
- auto (default)

The default value of auto leaves the decision up to the Ad Placement API. preloadAdBreaks can be set only once with adConfig(), and further values passed to preloadAdBreaks have no effect.
Setting preloadAdBreaks after the first call to adBreak() has no effect.
onReady string (OPTIONAL) Called when the API has initialized and has finished preloading ads (if you requested preloading using the preloadAdBreaks above).