Ir para o conteúdo
InstaPlay
Seções da documentação do SDK

Game analytics

InstaPlay.analytics.event(name, props?)

InstaPlay.analytics.event('shop_open', { from: 'menu' })
InstaPlay.analytics.event('boss_defeated', { boss: 'dragon', tries: 3 })
  • The name is ^[a-z][a-z0-9_]{0,39}$; props — up to 10 keys, values: a string ≤ 100 chars, a finite number or true/false.
  • A property key is ^[A-Za-z_][A-Za-z0-9_]{0,39}$ (Latin letters, digits and _, not starting with a digit, up to 40 chars; same as the server). A property with any other key or a value of another type is silently dropped — the event is sent without it (with init({ debug: true }) a message goes to the console). A string longer than 100 chars is truncated; keys beyond ten are dropped. An event with an invalid or reserved name is not sent at all.
  • The SDK buffers events (up to 200) and hands them to the portal in a batch every 10 s, every 20 events or when the tab is hidden; the portal sends them to the server every 30 s. No network is needed at call time.
  • InstaPlay.analytics.flush() — hand over the buffered events now.

Automatic events

The SDK and the portal record sdk_init, game_ready (with the load time), gameplay_start, gameplay_stop, heartbeat, session_end, js_error (10 % sample), level_started, level_completed, level_failed, happy_moment. These names are reserved.

Events contain no personal data: the player is an internal id, no IP and no user agent (only the device type). Raw events are kept for 90 days.