Track General Event

To track an event in Unity, you will use the TrackEvent function. The following example demonstrates how to track an event from a Unity script.

Method Signature:

public void TrackEvent(string eventName, Dictionary<string, string> parameters = null);

Explanation:

  1. Calling the TrackEvent Method:

    • The TrackEvent method is called on the activity object with the event name "casual_startgame".

Adding Parameters

If you need to pass additional parameters to the TrackEvent function, you can modify the call to include a dictionary of parameters.

Modified Example Script:

// Without parameters
NoctuaGame.TrackEvent("user_login", null);

// With parameters
Dictionary<string, string> params = new Dictionary<string, string>
{
    { "method", "email" },
    { "user_status", "active" }
};
NoctuaGame.TrackEvent("user_login", params);

Explanation:

  1. Dictionary Creation:

    • A dictionary of parameters is created with key-value pairs.

  2. Calling TrackEvent with Parameters:

    • The TrackEvent method is called with the event name and the dictionary of parameters.

Last updated