0.0.6 • Published 2 years ago

@gosynthschool/game-analytics v0.0.6

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
2 years ago

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