adBreak

The adBreak callback lifecycle

The adBreak() uses a number of callbacks during the lifecycle of an ad break. The Ad Placement API guarantees that during an ad break, each callback will be called in the following order:

  1. beforeBreak()
  2. afterBreak()

These callbacks will not be called if the API determines there is not an appropriate ad to display.

adBreak parameters

Name Type Description
type string The type of ad placement. Possible values:
- "start" - before the first level starts, but after some content has become visible to the user (eg. a loading screen has been displayed).
- "pause" - the user pauses the game.
- "next" - the user starts or navigates to the next level.
- "browse" - the user explores options outside of gameplay.
name string (Optional) A name for this particular ad placement within your game. It is an internal identifier, and is not shown to the user. We recommend you name all of your placements. In future releases this identifier may be used to enable additional reporting and optimisation features.
beforeBreak function Called before the ad is displayed. The game should pause and mute the sound (if it has any) in this callback. These actions must be done synchronously.
afterBreak function Called after an ad is finished (for any reason). This function should be used to resume game flow. For example unmute the sound and start the next level.