A Javascript service package for logging data in web games with OpenGameData's servers.
- Initial version
- Support for Firebase Analytics integration
- Firebase Analytics Integration fully hooked up, API simplifications.
using npm:
$ npm i opengamedata-js-log
OGDLogger
: handles communication with the OpenGameData databases using Ajax
An instance of the OGDLogger
can be created with the following format:
OGDLog log = new OGDLogger(myAppId, myAppVersion, firebaseConfig)
-
myAppId
: an identifier for this app within the database (ex. "MASHOPOLIS") -
myAppVersion
: the current version of the app for all logging events -
firebaseConfig
(Optional): an optional firebase app configuration object, used to enable logging to firebase
To send a user id along with every event, call OGDLogger.setUserId(userId);
You can send events using the OGDLogger.Log(eventName, eventParams)
method.
eventName
: event type identifiereventParams
: (optional) object containing custom event parameters
You can set up Firebase integration by either passing the firebaseConfig
object into the OGDLogger
constructor, or by calling OGDLogger.useFirebase(firebaseConfig)
method.
OGDLogger.setDebug()
can be called to set the logger's debug flag. If set, all requests and responses associated with OpenGameData event logging will be logged to the console.
To update the local package, run the following command:
$ git submodule update --remote
$ npm uninstall opengamedata-js-log