Skip to content

Game embeds ​

Embed a single game in a newspaper page using the same script initializer. No data attributes are needed.

js
MindtrainingPlatform.init('mindtraining', {
  mode: 'minimal',
  game: {
    type: 'quiz',
    // date: '2026-10-20',
    // category: 'current-affairs',
  },
})

The default mode is full. Choose minimal for the compact widget: no platform navigation, visible timer, help, settings, statistics drawers or achievement dialogs. Completion replaces the board with a card that fills the client allocation, showing the configured game icon, a completion message and result/statistics links in a new tab. No completion overlay is opened. Quiz is the first adapted game.

The game object is required in minimal mode. game.type is the API game type, not a title or URL. game.date is optional: omit it or use last for the latest publication, or provide a valid YYYY-MM-DD date. game.category is optional: omission or null selects the default configuration; a string selects that exact category. Unavailable or ambiguous selectors produce an error instead of choosing another game.

Minimal mode keeps the newspaper URL unchanged while the user plays. Time starts on interaction/focus inside the widget and pauses when it loses focus or the page becomes hidden. Access rules and state persistence still apply. Result/statistics links use the configured current domain and routing type; invalid domains do not fall back to another site.

Runtime updates ​

Use updateConfig() to change the mode or choose another game, passing the complete game object. In full mode, use game: null to clear the selection. Changing the game loads the new selection, so update it only when the user should switch games. mode is independent of ui.mode (web/app).

js
MindtrainingPlatform.updateConfig({
  mode: 'minimal',
  game: { type: 'quiz', date: 'last', category: null },
})

Script loading and readiness ​

Use the same script URL and init() configuration for full and minimal mode. The platform loads the files it needs automatically, including when you change the mode or game with updateConfig().

Wait for mindtraining:ready before calling init(). To hide your page’s loading indicator once the platform’s initial content is displayed, listen for mindtraining:sdk:loaded. The script tag’s load event alone does not mean the game is ready. See Events for listener examples.

Self-hosting requires the entire site build, including runtime.js, chunks/ and assets/, with their relative paths preserved. Module responses need a JavaScript MIME type and cross-origin access when hosted on another origin; the host CSP must allow the SDK origin. Publish hashed dependencies before entry files and retain old hashes for already-open pages.

Client integration documentation maintained in-repo.