Getting Started

One script tag gives your game login and analytics. A second package gives it cloud saves.

What you get

  • Authentication: Google and Discord login, a widget your players already recognise, and permissions you can tie to Discord roles.
  • Analytics: daily active players, average session length, and day-1/7/14/28 retention, counted from real sessions.
  • Player data, per-player cloud saves, read and written from your game server.
  • Progression: name your game's milestones and see which one players stop at, on the dashboard or as JSON. Start the list at the moment your game becomes playable: a funnel cannot see anyone who never reached its first step.
  • Errors: the crashes your players hit, from the browser and your game server, grouped and ready to hand to a coding agent.
  • Tokens: coming soon.
1

Get your API keys

  1. Sign up at indie.fun/signup.
  2. Go to your games and click New Game.
  3. Open the game, then Settings → API Keys → Generate API Keys.
  4. Copy the App ID (public, goes in your page) and the App Secret (server only, shown once).
The secret authenticates your game server. Keep it out of browser code, out of git, and out of anything you ship to players. If it leaks, regenerate it on the same screen.
2

Add the SDK to your game

Browser

<script src="https://indie.fun/js/indie.js"></script>
<script>
  const indie = new Indie({ appId: 'your-app-id' });
</script>

That single line mounts the login widget and starts measuring sessions. Analytics needs no further setup. From npm instead:

npm install indie-sdk

import { IndieClient } from 'indie-sdk/browser';
const indie = new IndieClient({ appId: 'your-app-id' });

Publishing on a portal, or a site with its own accounts?

On CrazyGames, Poki or your own site with its own sign-in, our login popup is no use to you and the pill would be a second account system on the screen. Pass login: false and keep everything else: sessions, session length, frame rate, progression and crash reports are all recorded for players who never sign in. Analytics has the whole setup.

Server (optional)

Only needed for cloud saves and for reacting to logins on your own game server.

const { Indie } = require('indie-sdk/server');

const indie = new Indie({
  appId: 'your-app-id',
  appSecret: process.env.INDIE_APP_SECRET,
});

indie.on('playerJoin', (player) => {
  console.log(player.id);          // unique player id
  console.log(player.name);        // display name
  console.log(player.data);        // saved data (already loaded)
  console.log(player.permissions); // { chat: true, vip: false }
});

// Save player data any time
indie.savePlayerData(player.id, { highScore: 9001 });
3

Check it actually works

Check it worked

Open the sandbox with your App ID. It loads the real SDK, sends real events, and tells you which ones we received, usually within a second or two.

Then open your own game and watch the same checklist under Settings → Setup on your game's page. Every line there is something we actually received, so nothing reads as “working” until it genuinely is.

From your game's own console, the same check by hand:

// in the page where you created the client
await fetch('https://indie.fun/api/sdk/verify', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    appId: indie.getAppId(),
    sessionId: indie.getSessionId(),
    deviceId: indie.getDeviceId(),
  }),
}).then(r => r.json()).then(console.log);

// { app: { exists: true, active: true },
//   session: { startedAt: '...', durationSec: 0, identity: 'device' }, ... }

session: null means nothing arrived. Check the App ID, and check the browser console for a blocked request. Full details in the API reference.

Where to next

  • Authentication: reading the logged-in player, verifying tokens server-side, Discord permissions.
  • Analytics: exactly how DAU, session length and retention are counted, and the consent rules for anonymous players.
  • Progression: two lines to name your milestones, and a funnel that says which one players stop at and how long they lasted first.
  • Errors: what the SDK captures on its own, how crashes are grouped, and how to pull them as a brief for a coding agent.
  • Tokens: what's planned, and what to do today so you're ready.