Configuration - GameAnalytics/GA-SDK-JAVASCRIPT GitHub Wiki

The configuration phase happens before initialization is called. The available configuration options are listed here.

  • build
  • custom userId
  • available (allowed) custom dimensions
  • available (allowed) resource currencies
  • available (allowed) resource item types

Build

Build is used to specify the current version of your game. Specify it using a string. Recommended to use a 3 digit version like [major].[minor].[patch]

<!-- Traditional way -->
gameanalytics.GameAnalytics.configureBuild("android 1.0.0");
<!-- Command queue -->
GameAnalytics("configureBuild", "android 1.0.0");

Custom userId

The SDK will automatically generate a user id and this is perfectly fine for almost all cases.
Sometimes it is useful to supply this user_id manually - for example if you download raw data for processing and need to match your internal user id (could be a database index on your user table) to the data collected through GameAnalytics. Do not use a custom userId unless you have a specific need for using it.

 

Note that if you introduce this into a game that is already deployed (using the automatic id) it will start counting existing users as new users and your metrics will be affected. Use this from the start of the app lifetime when you need.

<!-- Traditional way -->
gameanalytics.GameAnalytics.configureUserId("user1234567879");
<!-- Command queue -->
GameAnalytics("configureUserId", "user1234567879");

Specifying allowed values

For certain types it is required to define a whitelist containing possible unique values during the configuration phase. When the SDK is being used (after initialization) only the specified values will be allowed. 20 values are allowed for each list.

 

:information_source: Processing many unique dimension values can be taxing for our servers. A few games with a poor implementation can seriously increase our cost and affect stability. Games will be blocked if they submit too many unique dimension values. We have this configuration requirement to guide users into planning what dimension values can be used.

 

<!-- Traditional way -->
gameanalytics.GameAnalytics.configureAvailableResourceCurrencies(["gems", "gold"]);
gameanalytics.GameAnalytics.configureAvailableResourceItemTypes(["boost", "lives"]);
gameanalytics.GameAnalytics.configureAvailableCustomDimensions01(["ninja", "samurai"]);
gameanalytics.GameAnalytics.configureAvailableCustomDimensions02(["whale", "dolphin"]);
gameanalytics.GameAnalytics.configureAvailableCustomDimensions03(["horde", "alliance"]);

<!-- Command queue -->
GameAnalytics("configureAvailableResourceCurrencies", ["gems", "gold"]);
GameAnalytics("configureAvailableResourceItemTypes", ["boost", "lives"]);
GameAnalytics("configureAvailableCustomDimensions01", ["ninja", "samurai"]);
GameAnalytics("configureAvailableCustomDimensions02", ["whale", "dolphin"]);
GameAnalytics("configureAvailableCustomDimensions03", ["horde", "alliance"]);

 

:information_source:
Each resource currency string should only contain [A-Za-z] characters.

 

NEXT  →