The CustomEvent class

For simplicity and quick turn-around, the Analytics SDK offers a generic CustomEvent class that you can use for any custom event in a very similar way to the plain dictionary API used in earlier SDK versions. This comes at the cost of the type safety and validation options offered by using dedicated sub-classes for each type of event, but may be useful during migration or prototyping.

CustomEvent myEvent = new CustomEvent("MyEvent")
{
    { "fabulousString", "woah!" },
    { "peculiarBool", true },
    { "sparklingInt", 1337 },
    { "spectacularFloat", 313.37f }
};

AnalyticsService.Instance.RecordEvent(myEvent);

Warning: Although the parameter values are taken in as object type, values must actually be one of the following primitive types: string, int, long, float, double or bool. If you attempt to add a value of an unsupported type, the CustomEvent class throws an ArgumentException.