Part 2 - Download and Install

By Richard Davey on 24th November 2017   @photonstorm

2. Download the SDK for JavaScript

Next, download the GameAnalytics SDK for JavaScript. Once downloaded, you can begin the installation process.

3. Install the JavaScript SDK

Unzip the downloaded .zip and include this in your project (the files are located in the dist folder):

<script src="/path/to/GameAnalytics.js" />

or

<script src="/path/to/GameAnalytics.min.js" />

Versions

  • GameAnalytics.js includes local logging to the console and is 65Kb in size.
  • GameAnalytics.min.js is without logging and is 53Kb in size.

It is recommended to initially use GameAnalytics.js while implementing the needed tracking. This will make it easier to verify correct SDK instrumentation. When done it is possible to switch to GameAnalytics.min.js in production if it is needed to save the extra kilobytes.

npm

If you use node packages you can also install the SDK via npm:

npm install gameanalytics

And use it like this:

var gameanalytics = require('gameanalytics');

gameanalytics .GameAnalytics.setEnabledInfoLog(true);