Debugging - GameAnalytics/GA-SDK-JAVASCRIPT GitHub Wiki

The SDK is designed to be as silent as possible and use very few resources. You will therefore not get much information by default in your development console.

We have 2 different debug log types that can be enabled / disabled (at any time).

  • info log
  • verbose log

Info log

Short messages will be output when enabled explaining when some action is being performed by the SDK. Sometimes cropping text / values to make it more readable.

Enable info log when implementing the SDK - remember to turn it off in production!

<!-- Traditional way -->
gameanalytics.GameAnalytics.setEnabledInfoLog(true);
<!-- Command queue -->
GameAnalytics("setEnabledInfoLog", true);
 Info/GameAnalytics: Add DESIGN event: {eventId:someEvent, value:0}
 Info/GameAnalytics: Add DESIGN event: {eventId:someOtherEvent, value:100}
 Info/GameAnalytics: Add ERROR event: {severity:info, message:This is some in}

Verbose Log

Console output when each event is added (all fields) in JSON string format. This is the data being submitted to the GA servers for each event.

Enable verbose log when troubleshooting events.

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

This can result in a lot of text. When troubleshooting/debugging events it is therefore recommended to enable/disable when performing the action that need inspection.

Troubleshooting example.

 <!-- Tradional way -->
 // enable verbose log
 gameanalytics.GameAnalytics.setEnabledVerboseLog(true);
 // add event you need to troubleshoot / inspect
 gameanalytics.GameAnalytics.addDesignEvent("Some:Event", 100);
 // disable verbose log 
 gameanalytics.GameAnalytics.setEnabledVerboseLog(false);

 <!-- Command queue -->
 // enable verbose log
 GameAnalytics("setEnabledVerboseLog", true);
 // add event you need to troubleshoot / inspect
 GameAnalytics("addDesignEvent", "Some:Event", 100);
 // disable verbose log 
 GameAnalytics("setEnabledVerboseLog", false);

 

NEXT  →