### Initialize GameDistribution SDK Source: https://gamedistribution.com/developers/sdk/html5/?dev=show Implement this snippet in your game's index.html or within the game logic. Ensure the SDK is loaded before the game starts or during its loading phase. The GD_OPTIONS object can be obfuscated. The SDK handles advertisement events and GDPR consent. ```javascript window["GD_OPTIONS"] = { "gameId": "[YOUR GD GAME ID HERE]", "onEvent": function(event) { switch (event.name) { case "SDK_GAME_START": // advertisement done, resume game logic and unmute audio break; case "SDK_GAME_PAUSE": // pause game logic / mute audio break; case "SDK_GDPR_TRACKING": // this event is triggered when your user doesn't want to be tracked break; case "SDK_GDPR_TARGETING": // this event is triggered when your user doesn't want personalised targeting of ads and such break; case "SDK_REWARDED_WATCH_COMPLETE": // this event is triggered when your user completely watched rewarded ad break; } }, }; (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = 'https://html5.api.gamedistribution.com/main.min.js'; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'gamedistribution-jssdk')); ``` -------------------------------- ### Configure GameDistribution SDK Options Source: https://gamedistribution.com/developers/sdk/html5/?dev=show Set up the GD_OPTIONS object to configure game ID, prefix, and advertisement settings. Note that 'autoplay' is not recommended due to browser restrictions. ```javascript window["GD_OPTIONS"] = { "gameId": "49258a0e497c42b5b5d87887f24d27a6", "prefix": "awesome__", // Set your own prefix in case you get id conflicts. "advertisementSettings": { "debug": false, // Enable IMA SDK debugging. "autoplay": false, // Don't use this because of browser video autoplay restrictions. "locale": "en", // Locale used in IMA SDK, this will localize the "Skip ad after x seconds" phrases. }, }; ``` -------------------------------- ### Invoke Advertisement with gdsdk.showAd() Source: https://gamedistribution.com/developers/sdk/html5/?dev=show Call `gdsdk.showAd()` behind a touchUp/mouseUp event to display an ad. Ensure the `gdsdk` instance and `showAd` method exist before calling to handle potential SDK unavailability. ```javascript nextButton.addEventListener('mouseUp', function () { if (typeof gdsdk !== 'undefined' && gdsdk.showAd !== 'undefined') { gdsdk.showAd(); } }); ``` -------------------------------- ### Open Debugging Console Source: https://gamedistribution.com/developers/sdk/html5/?dev=show Call this function from a browser developer console to open the SDK's debugging toolbar. Clear your localStorage to disable debugging. ```javascript gdsdk.openConsole(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.