• Examples (iOS)
• Examples (Android)
• Examples (C++)
Server API Documentation


» Analytics module | Data collection

The collection of data displayed by Analytics is based on the analysis of the events logged by SmartFoxServer 2X; this is performed by an external process which can be launched manually or automatically by scheduling it in the server configuration, as described below.

The log analysis process takes care of parsing all the logs available in the default SmartFoxserver 2X logs folder. The log files that have been parsed during a previous run are skipped, unless rebuilding the full data is explicitly requested.

Collected data is saved in a reserved database inside SmartFoxServer and it is accessible through the AdminTool's Analytic module only. In no case data is shared with GotoAndPlay or third party organizations.

Analytics is fully compatible with logs generated by SmartFoxServer 2X v2.7 or later. Previous versions (2.5 and 2.6) are 90% compatible, which means that some statistics migth not be collected. Older versions might be incompatible: in this case log entries are simply skipped.
Also, it is mandatory that logs are generated with the default ConversionPattern setting for the FileAppender in the log4j configuration (see SFS2X /config/log4j.properties file).

» Manual logs processing

It is possible to launch the log processing manually by clicking the Setup button in the Analytics interface. The main view slides out and the log analysis controls are displayed on the left side:

By clicking on the Start analysis button the SmartFoxServer logs are processed starting from the last entry parsed during a previous run (if any), as indicated in the text above the button.

If the Rebuild data switch is active, the whole statistics database is dropped and all the available logs are re-processed from scratch. As this action can lead to data loss (for example if the existing database contains data extracted from older logs which have been deleted in the meanwhile), an alert is displayed before proceeding.

Please note that during the log parsing it is not possible to display data in the Analytics interface. It is anyway possible to close the AdminTool (or go to other modules) without the process being interrupted. Once the analysis is completed, the Latest processed log entry date/time is updated. This is the timestamp of the last valid entry in the logs, so it might be different from the timestamp of the last entry in general.

The log analysis process can be very time (and server resources) consuming, depending on the logs size. It can go from a few seconds up to many hours. For this reason launching it manually is not recommended. It is preferable to schedule it during the hour of the day (or week) when the game/application is less trafficked and administrators don't need to access the Analytics module (for example at night).

» Automatic logs processing

Log processing can be scheduled so that SmartFoxServer performs it automatically at a certain hour of a certain day of the week (or everyday too).

The scheduling can be configured in the Analytics tab of the Server Configurator module and requires the SmartFoxServer to be restarted:

Analytics tab


Schedule log analysis Activate this switch to turn on the scheduling.
Run on day of week Select the day of the week in which the log analysis process should run; it is also possible to make it run everyday.
Run at hour of day The hour of the selected day/s in which the log analysis process should run. If is recommended to execute it when the game/application is less trafficked and administrators don't need to access the Analytics module (so usually at night).
Run on startup If this option is active, as soon as SmartFoxServer is restarted, it will execute the log analysis process, in addition to the scheduling. This can be useful to launch the first run without waiting for the scheduled date and time.
Rebuild database

When this option is active, the first time the process is executed the whole statistics database is dropped; the Analytics data is then rebuilt processing all the existing SmartFoxServer logs.

This switch is automatically deactivated during the first run, to avoid accidental data destruction during the following executions.

Skip geolocation

If this switch is off, no geolocation of users' IP address will be performed during the data analysis.

Geolocation should always be enabled, unless the geolocation database is outdated and can't be updated. Read the Visitors geolocation paragraph below.

Logs source folder The path to the folder containing the SmartFoxServer logs to be processed; leave it empty to use the default folder.
Logs locale

The two letters ISO 3166 country code indicating the locale of the server which generated the log files; leave empty if logs are generated by the SmartFoxServer instance to which the AdminTool is connected

This parameter can be used to analyze logs which have been generated by a different SmartFoxServer instance hosted on a server with a different locale setting (usually because located in a different country).

For example this can be useful to collect the statistics analyzing the logs on a different machine, to avoid subtracting hardware resources to the production environment in trafficked games / applications.

» Stats extra logging

Metrics related to concurrent users and Room joins require some extra information to be logged by SmartFoxServer. This can be controlled using the Stats extra logging parameter in the General tab of the Server Configurator module.

The extra logging should be disabled of those metrics are not needed.

» Visitors geolocation

In order to provide a demographic view over the server metrics, MaxMind's GeoLite2 Country database is used to identify the users location by means of their IP address (both IPv4 and IPv6 are supported). The database is in binary format and it is located in the /data folder of SmartFoxServer, filename: GeoLite2-Country.mmdb.

The GeoLite2 database is licensed under the MaxMind GeoLite Commercial Redistribution License. This license allows Analytics customers to update their local database when a new version is made available by MaxMind on their website. Simply download the new .mmdb file and overwrite the existing one.


« back to Analytics table of contents

« back to AdminTool