@gosynthschool/game-analytics
v0.0.6
Published
game analytics library for synthesis games
Downloads
6
Readme
Synthesis Game Analytics
Installation
yarn add @gosynthschool/game-analytics
Usage
import { GameAnalytics } from '@gosynthschool/game-analytics'
// Create ga object with:
// gameName: 'Proxima', 'Constellation' ...
// logMode: 'console' (zeus) or 'http'
const ga = new GameAnalytics('Proxima', 'http')
// Send event
ga.event({
gameId: '99755',
event: 'runningOutOfFuel',
user: player,
team: 'cyan',
})
// Send a debounced event
ga.debounceEvent({
gameId: '99755',
event: 'runningOutOfFuel',
user: player,
team: 'cyan',
}, player.id, 1000) // id and duration
// Send throttled event
ga.throttleEvent({
gameId: '99755',
event: 'scoreBoard',
scoreBoard: game.scores
}, 'scoreBoard', 2000) // id and duration