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:
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.
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;
Events can be tracked by the following ways:
Log events without any parameters.
// log
events
MikrosManager.Instance
.AnalyticsController
.LogEvent("custom_event_name", (Hashtable customEventData) =>
{
// handle success
},
onFailure =>
{
// handle failure
});
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
});
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
});
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
});
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();
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.