Unity Events
The IV Metrics SDK contains an Event Logging System that can be used alongside the recording functionality. Events can be used for standard analytics and also for starting a recording session if the recording request was set up to do so in the IV Metrics panel.
There are four ways of sending an event; Lightweight, Fast, Standard and Detailed.
Event Details
- Event names are of string type, truncated to maximum 16 characters in length.
- Parameter names must be from the IVParameterName enum.
- Parameter values can be of type:
- string (Up to 16 characters in length)
- int
- float
- bool
Lightweight Event
The most basic of events, containing no supplementary data.
// Trigger an event when the Tutorial has been completed.
IVMetrics.IVMetricsManager.LogEvent("TutorialComplete");
Fast Event
These events can contain a secondary value that bypasses the need for the parameter name, this thereby will be sent with the default parameter name “value”.
// Trigger an event when the tutorial has progressed to stage 3
IVMetrics.IVMetricsManager.LogEvent("TutorialProgress", 3);
// Will produce the event:
// Name: "TutorialProgress"
// ParameterName: "value"
// ParameterValue: 3
Standard Event
These functions produce a larger amount of customisation over the event that gets sent to the IV Metrics servers. You can choose from one of up to 11 pre-configured parameter names to help describe your event for greater clarity when poring over them in the analytics panel.
// Trigger an event when the user has received a bunch of in-game coins
IVMetrics.IVMetricsManager.LogEvent("CoinsReceived", IVParameterName.Amount, 200);
// Will produce the event:
// Name: "CoinsReceived"
// ParameterName: "amount"
// ParameterValue: 200
Detailed Event
This function produce the maximum allowed customisation over the event that gets sent to the IV Metrics servers. This event will produce the most clarity for an event.
// Trigger an event with the user has received a bunch of various in-game currencies
IVMetrics.IVMetricsManager.LogEvent("CurrencyReceived",
new IVAnalyticsParameter(IVParameterName.VirtualCurrencyName, "Coins"),
new IVAnalyticsParameter(IVParameterName.Amount, 200),
new IVAnalyticsParameter(IVParameterName.Action, "DailyReward"));