Setup Ads

// @param {string} gameId - Y8 game id.
ID.ads.init(gameId);

Display Ads

// @param {function} callback - Function name that resumes game after ads are done.
ID.ads.display(callback)

Example

Initialize the ads after the sdk is initialized.

<script type="text/javascript">
  ID.Event.subscribe('id.init', function() {
    ID.ads.init('12345');
  });
</script>

Call ads.display() when you want to display ads like between game stages.

Remember to pause the game (including sounds) before displaying ads.

Pass a callback method to ads.display() so the game can resume after ads are finished.

<script type="text/javascript">
  // Pause game and sounds

  ID.ads.display(function() {
    // Resume game and sounds
  });
</script>