Initializing - GameAnalytics/GA-SDK-JAVASCRIPT GitHub Wiki
Call this method to initialize using the game key and secret key for your game.
<!-- Traditional way -->
gameanalytics.GameAnalytics.initialize("[game key]", "[secret key]");
<!-- Command queue -->
GameAnalytics("initialize", "[game key]", "[secret key]");
:bulb:
Don't have any keys yet? Head over here and register your game at the GameAnalytics website!
Below is a common example of the code placed in a script lets call it main.js.
function onStart(){
// ... other code from your project ...
<!-- Traditional way -->
gameanalytics.GameAnalytics.setEnabledInfoLog(true);
gameanalytics.GameAnalytics.setEnabledVerboseLog(true);
gameanalytics.GameAnalytics.configureBuild("0.10");
gameanalytics.GameAnalytics.configureAvailableResourceCurrencies(["gems", "gold"]);
gameanalytics.GameAnalytics.configureAvailableResourceItemTypes(["boost", "gold"]);
gameanalytics.GameAnalytics.configureAvailableCustomDimensions01(["ninja", "samurai"]);
gameanalytics.GameAnalytics.configureAvailableCustomDimensions02(["whale", "dolphin"]);
gameanalytics.GameAnalytics.configureAvailableCustomDimensions03(["horde", "alliance"]);
gameanalytics.GameAnalytics.initialize([game key]", "[secret key]);
<!-- Command queue -->
GameAnalytics("setEnabledInfoLog", true);
GameAnalytics("setEnabledVerboseLog", true);
GameAnalytics("configureBuild", "0.10");
GameAnalytics("configureAvailableResourceCurrencies", ["gems", "gold"]);
GameAnalytics("configureAvailableResourceItemTypes", ["boost", "gold"]);
GameAnalytics("configureAvailableCustomDimensions01", ["ninja", "samurai"]);
GameAnalytics("configureAvailableCustomDimensions02", ["whale", "dolphin"]);
GameAnalytics("configureAvailableCustomDimensions03", ["horde", "alliance"]);
GameAnalytics("initialize", [game key]", "[secret key]);
};