SDK reference

Init options

Every option Playgent.init() accepts.

js
const player = Playgent.init({
  containerId: "playgent-host",
  game: "sudoku",
  mode: "daily",
  player: "plyr_acme",
  // …
});

Required

containerIdrequired
string

The id of the host <div>. Must exist before init.

gamerequired
string

Game ID, e.g. sudoku, trivia, wordsearch.

moderequired
"pinned" | "daily" | "random"

How content is fed. See Content modes.

playerrequired
string

Player ID (plyr_…). Bundles origins, theme, features, CTA, and analytics stream. The embed will only load on origins this player allows.

Content

content
string

Publication ID (pub_…) for pinned mode, or channel ID (cha_…) for daily / random. Required for content-driven games (trivia, wordsearch, memoji, cluefinder, …); omitted for algorithmic games (sudoku, slider, …).

language
string
Language code.
difficulty
string
Game-specific difficulty.

Theme

theme
string

Built-in theme slug (e.g. pop-minimal, editorial-noir) or a custom theme ID (thm_…). Overrides whatever theme is set on the player.

navStyle
"light" | "dark"
Navbar contrast override.

Dimensions

width
string · default: "100%"
height
string · default: "450px"
maxWidth
string
maxHeight
string

Features

disableHints
boolean
disableLeaderboards
boolean
disableArchive
boolean
disableRestart
boolean
disableShare
boolean
disablePause
boolean
disableShowErrors
boolean
muted
boolean
hintCount
number
firstPlayInstructions
boolean

Identity

externalUserId
string
Max 128 chars.
externalUsername
string
Max 64 chars.

End screen

Optional call-to-action shown after the game ends. When the button is pressed, the game fires an onEnd event.

ctaText
string
ctaButtonText
string
ctaUrl
string
Optional — when set, the button opens the URL in a new tab on press.
playButtonText
string

In-view tracking

viewOnce
boolean · default: true
viewThreshold
number · default: 0.5
Fraction of iframe visible before view fires.

Callbacks

onReady
(data) => void
Game finished loading and is ready for input.
onView
(data) => void
Iframe entered viewport.
onStart
(data) => void
User pressed Play.
onComplete
(data) => void
User finished the game.
onEnd
(data) => void
User pressed the end-screen CTA button.
onError
(err) => void
Configuration or load error.