Give your players a link to share, and your Analytics tab tells you how many people it brought and whether your game grows on its own.
One call. When a player chooses to invite somebody, ask the SDK for a link and share it however your game shares things. The link credits that player, and everyone who opens it and goes on to play is counted as a player they brought.
The result is the Invites report in your game's Analytics tab: invites sent, the new players they brought, and the viral coefficient.
<script src="https://indie.fun/js/indie.js"></script>
<script>
const indie = new Indie({ appId: 'your-app-id' });
inviteButton.onclick = async () => {
const link = await indie.invite();
await navigator.clipboard.writeText(link);
// or: navigator.share({ url: link }), or your own share dialog
};
</script>Each call is one invite sent, so call it when the player actually invites somebody rather than when your menu opens. The player gets the same link every time; it adds ?indie_invite=… to your game's address and keeps whatever else was there.
indie.fun/play/your-game; a game on your own site is linked at the page it is running on.?indie_invite= on it is reported as the SDK starts. There is nothing to call on the receiving side.invite() still returns a link, so sharing still works, but it carries no invite and nothing is counted. The same goes for an arrival: it is reported only once the visitor may be tracked.Who gets the credit
The first invite link somebody opens is the only one that brought them. Opening a second friend's link later changes nothing, and opening your own link is never counted.
A player who arrives as a guest and signs in later is still the same invited player.
await invite()A link to your game crediting this player. Each call is one invite sent. Always resolves to a link.POST /api/player/inviteBody { deviceId? }, with X-App-Id and either the player's bearer token or a deviceId. Returns { code }, the player's own invite code.POST /api/player/invite/acceptBody { code, deviceId? }, with X-App-Id and either the player's bearer token or a deviceId. Records that this player arrived on that code.