SDK Guide & Tools

Create Your Account

Create your account before using our SDK.

Add the .js file to your index.html page

<script type="text/javascript" src="https://huhgames.com/api/sdk/huh.js"></script>

Call init() after everything loads

GameSDK.init('YOUR_DEV_ID', 'YOUR_PUBLISHER_ID');

Interstitial Ads *required

Call ads during natural game breaks (Before level, after level, etc). Pause game and music while ad is playing.

//
// pause game / music before calling:
//
GameSDK.APIAds.show(function() {

  //
  // ad is finished, unpause game/music
  //

  console.log("ad completed");

});

Reward Ads *recommended

Increase Revenue

Games using reward ads earn 3x more on average. Give users rewards (extra life, puzzle hints, etc) for watching an ad.

Reward ads work in two steps:

// step 1: call this to check if reward ad available
GameSDK.GEvents.reward(canShowReward, rewardSuccess);
// this will be called if a reward ad can be shown or not
var canShowReward = function(success, showAdFn) {
  if(success) {
    // you can show user a button for a reward, must call showAdFn() on click
    // ex: rewardButton.onclick = function() { showAdFn(); }
  } else {
    // no ad to show, do nothing
  }
}
// after ad is played (after showAdFn() is called)
var rewardSuccess = function(success) {
  if(success) {
    // give user the reward
  } else {
    // no reward
  }

  // remove reward button
  // ex: rewardButton.remove();
}

Increase Engagement & Visibility

You can add Achievements and High scores while uploading your game. These features increase game plays, revenue and visibility.

Achievements

var api_awards = [];
api_awards.push(AWARD_ID);
// can push more than one award at a time
GameSDK.Achievements.save(api_awards, function(response) {
  if(response.success) {
    console.log('achievement saved');
  } else {
    console.log(response.errormsg);
  }
});

High Scores

var boardinfo = {};
boardinfo.score = SCORE_VAR;
boardinfo.board = HS_BOARD_ID;
GameSDK.Scores.save(boardinfo, function(response) {
  if(response.success) {
    console.log('high score saved');
  } else {
    console.log(response.errormsg);
  }
});

User Information

GameSDK.User.get(function(userData) {
  console.log(userData);
  console.log(userData.user.id);
  console.log(userData.user.name);
  console.log(userData.user.avatar);
});

Construct 3

Download SDK

Make sure "Use Worker" is set to "No" in advanced project settings for SDK to work correctly.

Call INIT after everything is loaded

Insert your Developer ID and Publisher ID

Lagged Developer ID:

YOU_DEV_ID

Developer Adsense Publisher ID:

YOUR_PUBLISHER_ID

Ads *required

Call show ad action

Trigger once on button clicks (start button, next level button, restart button, etc). SDK handles Ad cooldown. In dev mode ads will show each time for testing.

Reward Ads *recommended

Increase Revenue

Games using reward ads earn 3x more on average. Give users rewards (extra life, puzzle hints, etc) for watching an ad.

Two steps: Check if ad available, if it is then show user a button to click

Step 1: Call Check if Reward Ad Available (step 1) action (can be called at any point, usually takes 200ms to return true/false)

Step 1 Condition: Reward Ad Check (step 1)
If there is an ad available this will trigger true.
Now you can show a button the user can tap with Play Reward Ad (step 2) action.

Step 2 Conditions: Use Reward Ad Success to give user the reward and Reward Ad Failure to get pinged when reward ad failed.

Increase Engagement & Visibility

You can add Achievements and High scores while uploading your game. These features increase game plays, revenue and visibility on Lagged.

Achievements

Save Achievement action, Trigger once when true:

Example achievement ID:

example_awardid_j001

High Scores

Save score action, score=whole integer, trigger once

Example board ID:

example_boardid_jf01

User Information

Get user variables (expressions). Registered users will have an ID 0

UserName UserID UserAvatar

© 2025 Huh Games