Sending Custom Events
The SDK gathers and sends many standard events throughout a participant's session. Developers can augment these events with their own Custom Events, including properties and property values.
Custom Events automatically record x,y,z
coordinates. If the position is not provided it will use the position of the HMD. In conjunction with Gaze tracking, coordinates give you the ability to map out how your Participants are interacting with your experience in 3D space.
Setup
Custom Events are visible on the Dashboard on the Session Details page and Analysis Tool. They are also a common feature of the Objectives system.
Custom Events can be recorded with a small amount of code.
// create event
let event = CustomEvent(
name: "My Event Name",
properties: [
"exampleEventProperty": "This is a string as an Event property"
],
core: analytics
)
// send the event
let success = event.send()
Custom Events can be created using chaining.
let success = CustomEvent(name: "ErrorOccurred", core: analytics)
.sendWithHighPriority(position)
Duration
In some cases you may want to record a span of time with a Custom Event. Simply create a new Custom Event object and call Send at a later time. This will automatically add a Duration property to the Custom Event.
Dynamic Object Custom Events
Custom Events can be assigned to Dynamic Objects. This can be used to identify interactions with specific objects. A summary of Custom Events can be seen on the Dynamic Objects page.
To assign a Dynamic Object to a Custom Event the code is similar to how properties are added:
private func createEvent(dynamicId: String) {
let core = Cognitive3DAnalyticsCore.shared
let event = CustomEvent(
name: "tapEvent",
properties: [
"description": "User has made a spatial tap on an entity in the scene"
],
dynamicObjectId: dynamicId,
core: core
)
let success = event.send()
}
If you have a question or any feedback about our documentation please use the Intercom button (purple circle) in the lower right corner of any web page or join our Discord.