Connect your game with our SDKs

GameDistribution SDK for Defold

The repository containing the GameDistribution SDK for Defold games. This allows you to display advertisements and other solutions available to games published within the GameDistribution network.

Registering as a developer

Before you can start using GameDistribution you need to register as a developer:

When you have registered as a developer you also need to register your game in the GameDistribution developer portal:

When you have registered the game head to the Upload tab and copy the Game ID:


You can integrate GameDistribution in both new games and in existing games. Please follow the instructions below depending on your situation.

Creating a new game

If you are creating a new game it is recommended that you use the GameDistribution project template from the Defold editor Welcome screen. The GameDistribution template includes the GameDistribution SDK extension:

GameDistribution template

Add your Game ID to the GameDistribution section of the game.project file:

Adding game id game.project

Configuring an existing game

If you wish to use GameDistribution with an existing game you can open the game.project file and in the Dependencies field in the Project section add:

Open the game.project file using a text editor and add a new section with your Game ID:



To use the GameDistribution SDK in a Defold game you need to first set up a listener function to receive events from the GameDistribution SDK. The listener function will receive events when an ad is shown and the game should be paused and when an ad is closed and the game should be resumed.

gdsdk.set_listener(function(self, event, message)
    print(event, message)
    if event == gdsdk.SDK_GAME_PAUSE then
        -- pause your game
    elseif event == gdsdk.SDK_GAME_START then
        -- resume your game
        elseif event == gdsdk.SDK_REWARDED_WATCH_COMPLETE then
                -- give reward to player (optional)

Once you have the listener functions set up you can start showing ads. The GameDistribution SDK supports Rewarded Ads, Interstitial Ads and Display Ads.

Showing a Rewarded ad

Use Rewarded Ads to give the user premium content, extra lives, in-game currency and so on. You show a Rewarded Ad like this:


Showing an Interstitial Ad

Use Interstitial Ads during screen transitions, between sessions and in other situations where there is a natural pause in game play. You show an Interstitial Ad like this:


Showing a Display Ad

Use Display Ads (also known as a banner ad) at your discretion but make sure to not cover any of your game content. You need to manually add a <div> where the Display Ad will be shown. Example:

<!-- center and anchor to bottom of page -->
<div style="position: absolute; bottom: 0px; left: 50%;">
    <div id="canvas-ad" style="width: 728px; height:90px; margin-left: -50%;"/>

Give the <div> a size that matches one of the supported display ad sizes.

You show and hide a Display Ad like this:

-- show it

-- hide it

Verify the SDK implementation

To verify your SDK implementation; make sure to completely view an advertisement, while viewing your game through an iframe launched from the Upload tab of the GameDistribution developer portal page for you game.