sg-game-analytics
v0.0.5
Published
## Getting started
Downloads
4
Readme
Skill Guilds game analytics
Getting started
You can get analytics api key and use this library
Main methods
setApiKey(key: string)
sendUserData(user: object)
sendUserDataWithTimestamp(user: object, datetime: Date)
sendEvent(event: string|object , user: string|object|null)
sendEventWithTimestamp(event: string|object, datetime: Date, user: string|object|null)
Main entities
user: {
id: string (required),
any: string|number,
...
}
event: {
name: string (required),
any: string|number,
...
}
Usage
const {SgGameAnalytics} = require("sg-game-analytics");
SgGameAnalytics.setApiKey("{API_KEY}");
const user = {id: "qwe123", anyField: "anyValue"};
const event = {name: "eventName", anyField: "anyValue"};
SgGameAnalytics.sendUserData(user);
SgGameAnalytics.sendUserDataWithTimestamp(user, new Date());
SgGameAnalytics.sendEvent("eventName");
SgGameAnalytics.sendEvent(event);
SgGameAnalytics.sendEvent(event, user);
SgGameAnalytics.sendEventWithTimestamp(event, new Date(), user);