Skip to end of metadata
    Go to start of metadata

    Marmalade Analytics, powered by GameAnalytics, lets you easily integrate analytics into your Marmalade Core (C++) and Marmalade Quick (Lua) projects.

    With a single cross-platform API and a powerful set of out-of-the-box metrics you can rapidly instrument your code and start gaining insights into your players' behaviour.

    The following guide explains how to get started with Marmalade Analytics.

    Topics

    Creating a GameAnalytics account

    To use Marmalade Analytics you will need a GameAnalytics account.

    You can use your existing Marmalade account to sign up:

    • Launch the Marmalade Hub.
    • On the Hub Home page, click the ANALYTICS button.

    The Marmalade Analytics page will appear.

    • Click GET STARTED.

    • In the pop-up that appears, provide your Marmalade account e-mail address and password.
    • Click LOG IN.
    • Follow the instructions to complete the creation of your GameAnalytics account.

    Creating a GameAnalytics game

    To allow your Marmalade app to communicate with Marmalade Analytics you need to create a game in GameAnalytics.

    The first time you login to the GameAnalytics portal you will be guided through the process of creating a game.

    Make sure you complete this process so that you can see how easy it is to add analytics to your game in the next section.

    Adding analytics to your game

    Marmalade Analytics supports tracking of the following types of events:

    • Business events (used to track purchases)
    • Resource events (used to track resource acquisition and consumption)
    • Progression events (used to track progress through the game)
    • Design events (used to track events that relate to gameplay)
    • Error events (used to track your game's state)

    Below, we'll show you how to quick it is to add some of these types of events to your Core and Quick projects.

    Core projects

    Setup

    • Add a reference to the iwanalytics middleware module in the subprojects section of your project's MKB file.
    • Include the IwAnalytics.h header in the source file that contains your main() function.

    Initializing

    • Call IwAnalytics::Init() in your main() function, passing in callback functions that will be called when the analytics system is initialised and ready to be used or if an error occurs.
    • The ReadyCallback() is an ideal place to start a session by calling IwAnalytics::SendSessionStart().
    • Replace "game_key" and "secret_key" with the values from the GameAnalytics portal (click the Game settings gear icon and look for them in the Game information panel).
    • Replace "version" with the current version of your game. It's recommended that you use a 3 digit version like [major].[minor].[patch] for example "1.0.1".

    Instrumenting code

    Now that you have initialised the analytics system and started an analytics session it's easy to instrument your code to send analytics events.

    For example, to send an analytics event to record consumption of a resource in your game you can call:

    Or, to send an analytics event to track player progress through your game you can call:

    Please see the IwAnalytics middleware overview for details of other analytics events that can be used to instrument your C++ code.

    Quick projects

    Setup

    • The Analytics library is already included in Quick projects and can be used immediately without any setup.

    Initializing

    • Call analytics:init() in main.lua, creating an event listener that will be called when the analytics system is initialised and ready to be used or if an error occurs.
    • The event listener is an ideal place to start a session by calling analytics:sendSessionStart().
    • Replace "game_key" and "secret_key" with the values from the GameAnalytics dashboard (click the Game settings gear icon and look for them in the Game information panel).
    • Replace "version" with the current version of your game. It's recommended that you use a 3 digit version like [major].[minor].[patch] for example "1.0.1".

    Instrumenting code

    Now that you have initialised the analytics system and started an analytics session it's easy to instrument your code to send analytics events.

    For example, to send an analytics event to record consumption of a resource in your game you can call:

    Or, to send an analytics event to track player progress through your game you can call:

    Please see the Analytics library overview for details of other analytics events that can be used to instrument your Lua code.

    Tracking and analyzing data

    The GameAnalytics portal is where you can track and analyze your analytics data with the help of various visualizations and tools.

    To get a feel for what's possible, take a look at the Demo game on the Home page.

    Further reading

    Labels
    • No labels