Get started

Publish your web game on GOOF and earn from rewarded ads, interstitials and in-app purchases. You add one script, test on your own machine, then upload a build.

What you need

The steps

  1. Create a game in your dashboard. You get an app id (it starts with d) and a server secret. The secret is shown once, so keep it somewhere safe.
  2. Add the SDK script to your page and call GOOF.game.init().
  3. Create ad units and products for your game in the Monetization tab.
  4. Test on your machine. On localhost the SDK runs a mock host with test ads and a test payment sheet.
  5. Upload a build, try it in the test player, then submit it for review.

Add the SDK

Put this tag in your index.html, before your game code:

<script src="https://developer.goof.gg/sdk/v1/goof.js"></script>

It defines window.GOOF. It has no dependency and also loads as a module.

Start the SDK

const info = await GOOF.game.init({ gameId: 'dYOUR_APP_ID' });
console.log(info.host);          // "android", "ios", "web", "mock" or "none"
console.log(info.can.rewarded);  // what this host supports

// When your first screen is ready:
GOOF.game.setLoadingProgress(1);
GOOF.game.gameReady();

GOOF.game.init() is safe to call more than once. Every other call waits for it by itself, so you can also skip it.

Your first rewarded ad

const { rewarded } = await GOOF.ads.showRewarded({ adUnitId: 'au_0123456789ab' });
if (rewarded) giveExtraLife();

This promise never rejects. See Ads for the full ad object with events.

Test locally

When no GOOF host answers within one second, the SDK picks a host:

You can also run a build in the simulator.

Next