Logging Analytics Events

Welcome to the Facebook Instant Games SDK Tutorials. This series of tutorials covers many aspects of using the Facebook Instant Games SDK.

In this tutorial we will take a look at working with analytics using the Facebook Instant Games SDK.

Logging Events

Every Facebook Instant Game logs a standard set of events within the Analytics section of your game in the Facebook dashboard. You can view these events by visiting the Events section. These events are used to measure key performance indicators (KPI) of your game such as retention, custom updates, social sharing etc..

In addition to these default events you can send your own custom events which will also appear in the events sections. This enables you to log important information about your players behaviours within your game. For example, you may want to determine how many people attempt to make a purchase but then change their mind, or maybe you just want to check the visibility of a specific section of your game.

The Facebook Instants SDK provides the FBInstant.logEvent() which allows you to log custom events:

[sourcecode language=”js”]
FBInstant.logEvent(name, value, params);
[/sourcecode]

name is the name of the event to log, value is an optional numeric value that analytics can use to calculate a sum with and params is an optional object that contains up to 25 key-value pairs that can be logged with the event.

Leave a Reply