Get started

Quickstart

Embed your first game and listen for an event — about 60 seconds end to end.

1. Add the SDK

Drop the script anywhere on your page (typically in the <head> or before </body>):

html
<script src="https://static.playgent.com/player/v2.js"></script>

2. Create a player

A player bundles your allowed origins, theme, features, end-screen CTA, and analytics stream — so every embed on your site stays consistent. You'll reference it on every Playgent.init call.

Create one in the Hub (Configuration → Players → New player) and copy its plyr_… ID.

Origins

A player only loads on origins you've added to its allowlist. Add localhost (or wherever you're testing) before the first run.

3. Mount a game

Place a host element where the game should render, then call Playgent.init:

html
<div id="playgent-host"></div>
<script>
  Playgent.init({
    containerId: "playgent-host",
    player: "plyr_acme",
    game: "sudoku",
    mode: "daily",
  });
</script>

That's it — playgent-host now renders a fresh Sudoku puzzle every day at midnight UTC.

Most other games (trivia, wordsearch, memoji, …) also need a content ID — see Content modes for the full picture.

4. Listen for events

Pass callbacks to react to lifecycle events on the host page:

js
Playgent.init({
  containerId: "playgent-host",
  player: "plyr_acme",
  game: "sudoku",
  mode: "daily",
  onReady:    ({ game, content }) => console.log("ready", game, content),
  onStart:    ({ content })       => console.log("started", content),
  onComplete: ({ score, timeMs, won }) =>
    console.log("done", { score, timeMs, won }),
  onError:    ({ code, message })   => console.warn(code, message),
});

The full set of lifecycle events is documented in the SDK events reference.

What's next