Skip to content

Custom Events

Custom Events are the primary way Cognitive3D collects telemetry data (user events) from your product.

Custom Events automatically record x,y,z coordinates. If the position is not provided, it will use the position of the HMD. This allows us to map every Custom Event to a specific point in your VR experience. In conjunction with visual telemetry (gaze tracking), coordinates gives you the ability to map out how your users are interacting with your product at a 3d space.


There are two ways to record Custom Events - either by calling a function with all the properties or by constructing an object that will persist until manually recorded. The second option will also automatically record a 'duration' property describing the time between its construction and when the user calls 'Send();'


Blueprints

You can use an array of AnalyticsEventAttr to add properties to a custom event. There are some overloaded blueprint functions to append Dynamic Object information and Position information. AnalyticsEventAttr will not be able to record data types, so all properties will be recorded as string values.

simple events


Alternatively, you can make a Custom Event object and add properties however you would like. This method will append a duration to the event automatically. The Set Integer Property (and matching Set Bool Property, Set Float Property and Set String Property) will record the data type

custom event object


C++

Custom Events can be created with the code below. You can create a FJsonObject to add properties to your custom events. Unlike AnalyticsEventAttr in Blueprints, this will correctly save the type of property - int, float, bool - instead of converting it to a string.

TSharedPtr<FAnalyticsProviderCognitiveVR> provider = FAnalyticsCognitiveVR::Get().GetCognitiveVRProvider();
provider->customeventrecorder->Send("Button Activated");
provider->customeventrecorder->Send("Button Activated",FVector(0,100,0));

TSharedPtr<FJsonObject> properties = MakeShareable(new FJsonObject());
properties->SetStringField("last login", FString("never"));
properties->SetNumberField("login attempts", 4);

provider->customeventrecorder->Send("Button Activated", properties);
provider->customeventrecorder->Send("Button Activated", FVector(0, 100, 0), properties);

//immediately upload events
provider->FlushEvents();

Just like in Blueprints, you can make a Custom Event object that will persist until you manually record the data point with the Send() method.

UDynamicObject* dynamic = NULL;

FCustomEvent customEvent = FCustomEvent("category");
customEvent.SetDynamicObject(dynamic);
customEvent.AppendSensors();
customEvent.SetProperty("somekey1", 5);
customEvent.SetProperty("somekey2", "somevalue");
customEvent.SetPosition(FVector(0, 100, 0));
customEvent.Send();