
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
gameanalytics-node-sdk
Advanced tools
GameAnalytics Node SDK is a server-side wrapper for the GameAnalytics v2 REST API. This library offers full support for all of the event types outlined in the REST API documentation. It also covers the best practices specified including automatic batching of events, GZIP compression and validation of event data.
npm install gameanalytics-node-sdk
yarn add gameanalytics-node-sdk
First, create a free account at https://gameanalytics.com. Then, setup a game and get your key and secret to setup your SDK connection. In this example, we setup the SDK, start a new user session (must be the first thing you do) and track a design tutorial event (the events are just pseudocode).
const GameAnalytics = require('gameanalytics-node-sdk');
// Setup the SDK.
const GA = new GameAnalytics({
key: 'GAME_KEY',
secret: 'GAME_SECRET',
build: '1.2.3',
sandbox: false,
});
// Handle a player logging in.
game.on('login', (userId, client) => {
GA.sessionStart(userId, {
ua: client.ua,
ip: client.ip,
device: client.device,
manufacturer: client.manufacturer,
session_num: client.session_num,
});
});
// Track a tutorial design event.
game.on('tutorial', (userId, step) => {
GA.track('design', userId, {
event_id: `Tutorial:${step}`,
});
});
new GameAnalytics({
key: 'GAME_KEY', // Your GameAnalytics game key.
secret: 'GAME_SECRET', // Your GameAnalytics game secret.
build: '1.2.3', // The current build version of your game.
sandbox: false, // Whether or not to use the sandbox for testing.
});
Must be the first thing called to initialize the user session.
String
The unique user ID that identifies this player.Object
The data to send with this event (minimum required are platform
, os_version
and sdk_version
as found in the REST API docs for init
).Should be the last thing called for a user to identify the end of their game session. This will flush all pending events before this final event is sent.
String
The unique user ID that identifies this player.Everything that happens between session start and end happens with this method to track any type of event.
String
This can be a value of business
, resource
, progression
, design
or error
.String
The unique user ID that identifies this player.Object
The data to send with this event. Check the REST API docs for each event type to see what is required for an event.There are a list of default properties that can be sent with any event, which can be found in the REST API docs. Some of these properties are required; however, if they are passed with the sessionStart
method, they will get automatically sent with each event during the player's session.
The platform
and os_version
can be identified automatically if you pass the ua
property the User Agent string from the browser to sessionStart
.
Copyright (c) 2018 James Simpson and GoldFire Studios, Inc.
Released under the MIT License.
FAQs
Unofficial GameAnalytics Node.js SDK using the REST API.
The npm package gameanalytics-node-sdk receives a total of 39 weekly downloads. As such, gameanalytics-node-sdk popularity was classified as not popular.
We found that gameanalytics-node-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.