Documentation

Log Custom Events

Events provide insight on what is happening in your app. You can use MIKROS LogEvent() function to track user experiences and player behavior across various major areas:

  • Application: Track the usage of basic elements in your application user interface.
  • Progression: Track player progress through your application or game.
  • Onboarding: Track the earliest interactions players have with your application or game.
  • Engagement: Track important actions related to social sharing, achievements and milestones.
  • Monetization: Track revenue-related events as well as your in-game economies.

In addition to the events that you track, MIKROS automatically logs some events for you; you don’t need to add any code to receive them. If your app needs to collect additional data or has specific needs, we also provide you with a variety of preset events to choose from. These preset events are meant to guide you on the type of information you should be collecting from your users.

Note: Event names are case-sensitive and logging two events whose names differ only in casing will result in two distinct events.

Before You Begin

Make sure that you’ve set up your project and have your appGameId and apiKeys issued as described in Getting Started With Mikros Unity SDK.

Mikros Analytics

Once you have initialized the SDK, you can immediately start logging events for analytics. Make sure you have the following namespaces defined at the top of your scripts:

using MikrosClient;
using MikrosClient.Analytics;

Track Custom Events

Events can be tracked by the following ways:

  1. Log events without any parameters.

    // log events
    MikrosManager.Instance
    .AnalyticsController
    .LogEvent("custom_event_name", (Hashtable customEventData) =>
    {
       // handle success
    },
    onFailure =>
    {
       // handle failure
    });

  2. Log events with only one parameter of String datatype.

    // log events
    MikrosManager.Instance
    .AnalyticsController
    .LogEvent("custom_event_name", "parameter", "parameter_value",
    (Hashtable customEventData) =>
    {
       // handle success
    },
    onFailure =>
    {
       // handle failure
    });

  3. Log events with only one parameter of Double datatype.

    // log events
    MikrosManager.Instance
    .AnalyticsController
    .LogEvent("custom_event_name", "parameter", 1.5, (Hashtable customEventData) =>
    {
       // handle success
    },
    onFailure =>
    {
       // handle failure
    });

  4. Log events with only one parameter of Long datatype.

    // log events
    MikrosManager.Instance
    .AnalyticsController
    .LogEvent("custom_event_name", "parameter", 1, (Hashtable customEventData) =>
    {
       // handle success
    },
    onFailure =>
    {
       // handle failure
    });

  5. Log events with multiple parameters of any datatype.

    // create Hashtable
    Hashtable data = new Hashtable();
    data.Add("parameter1", "parameter_value");
    data.Add("parameter2", 1.5);
    data.Add("parameter3", 1);
    data.Add("parameter4", true);

    // log events
    AnalyticsController
    .LogEvent("custom_event_name", data, (Hashtable customEventData) =>
    {
       // handle success
    },
    onFailure =>
    {
       // handle failure
    });


All custom events are uploaded automatically to backend at a feasible time whenever the phone is idle. However, these events can also be uploaded any time in the following way:

AnalyticsController.FlushEvents();

View Events on the Dashboard

Now that you have logged your events, you can see everything on your MIKROS dashboards. Go to the Analytics -> Events section from the left sidebar. These dashboards update periodically throughout the day, and are available for viewing in relatively real time.