An unofficial wrapper library for GameAnalytics. If you are searching for the official library, you'll want to check out their npm module.
To get started:
const GameAnalytics = require("not-game-analytics")
GameAnalytics.BUILD_VERSION = "vX.Y.Z"
GameAnalytics.GA_GAME_KEY = "XXXXXXXXXXXXX"
GameAnalytics.GA_SECRET_KEY = "XXXXXXXXXXXXX"
To use:
GameAnalytics.reportStageStart("Stage1")
GameAnalytics.reportStageSuccess("Stage1")
GameAnalytics.reportStageFailure("Stage1")
GameAnalytics.reportDesignEvent("FireLord:Death")
GameAnalytics.reportError(new Error("Something went wrong"))
To optionally configure:
GameAnalytics.isLogging = true // set to true to show the logs.
GameAnalytics.isReporting = false // set to false to not send reports.