How to Track Events

From Packages\Strivr SDK\Runtime\, drag the StrivrSDKDataManager prefab into the first scene. Then add the Strivr.SDK namespace to your script(s):

using Strivr.SDK;

To track an event, call the TrackEvent method:

StrivrAnalytics.TrackEvent("Example Event Name").End();

The argument for the TrackEvent method is a string that represents the name of the event. Event names must be non-empty strings between 1-64 characters, and must contain only alphanumeric characters (a-zA-Z0-9), spaces, underscores, or dashes. When constructing your event names, it’s best to optimize for readability so the dashboard will be human-readable.

You can add any number of parameters to an event. To do so, simply chain the Add method to the TrackEvent call.

Add(string key, string value)

There are multiple overloads for this method that accept the value as a different type including float, double, int, bool, Vector3, or TimeSpan. For any other types, use the ToString() method when possible. Key values follow the same rules as event names, must be non-empty strings between 1-64 characters, and must contain only alphanumeric characters (a-zA-Z0-9), spaces, underscores, or dashes. Again, optimize for readability.

Once you are done adding parameters, finish off the method call by chaining the End() method. Even if you create a custom event without parameters, you must still end the method call with End().

Examples of usage:

StrivrAnalytics.TrackEvent("Sample Event").End();
StrivrAnalytics.TrackEvent("Clicked Object")
   .Add("Object Name", hit.transform.name)
   .Add("Click Position", hit.point)
   .Add("Click Duration", holdTime)
   .Add("Experience Name", experienceName)
   .End();