Immerse

Adding reporting to an Immerse scene

All users, objects and interactions in a scene can be tracked and logged using the Immerse Platform services. This affords huge possibilities for deep insights into user activity, which in turn can be tracked back to training KPIs.

📘

Add reporting as the last step in deployment, as interactions and processes might need to be modified throughout the development process.

1. Identify Roles And Reportable Objects

  • Identify and list the roles that users will take on when they use the Immerse application. For example, a multi-user experience may have a 'Teacher' and a 'Learner' role.

  • Think about the start and end states of the experience. These are usually the first and last thing a user does, typically a user interaction.

  • Identify all interactable objects that should be included in the report

2. Sending data

Adding Roles

These roles will be automatically added as metadata when you build and upload your scene.

Reporting

To send a report, simply call the Report.Send method. This method is static and can be called at any time after you are connected to a session.

Example 1: Simple Collision

Below is an example script that will report each collision for a Game Object. The basic event data is used to display which object we are reporting on. In this example, we have added some results that include which object the Game Object collided with, the speed of the collision and how many points of contact.

using ImmerseSDK.Reporting;
using UnityEngine;

public class CollisionReportingExample : MonoBehaviour
{
    private void OnCollisionEnter(Collision collision)
    {
        // Call our reporting method
        ReportCollision(collision.transform.name, collision.relativeVelocity.magnitude,
            collision.contactCount);
    }
  
    private void ReportCollision(string otherGameObject, float speed, int contactCount)
    {
        // Gather basic event data
        const string eventType = "Collision";
        const string objectType = "Game Object";
        var objectId = gameObject.name;

        // Collect (optional) data associated with event
        var results = new[]
        {
            MessageResult.Create("Other Game Object", otherGameObject),
            MessageResult.Create("Speed", speed),
            MessageResult.Create("Contact Count", contactCount)
        };

        // This sends the report
        Report.Send(eventType, objectType, objectId, results);
    }
}

Example 2: xAPI Format

It is possible to track all kinds of events using reporting. Here is an example of a script that will send a report when an object is snapped to a target.

This report message is using the xAPI format. Which has 4 optional fields: Score, Completion, Time and Comment.

This is how the GameObject is set up. We are using the OnSnap event on the TransformSync to call the OnSnappedToTarget method.

using ImmerseSDK.Interaction;
using ImmerseSDK.Reporting;
using UnityEngine;

public class SnapTargetReportingExample : MonoBehaviour
{
    [Tooltip("The snap target we're interested in for reporting")]
    [SerializeField] private SnapTarget _requiredSnapTarget;

    public void OnSnappedToTarget(SnapTarget snapTarget)
    {
        // If it's not the required snap target, we can ignore this event
        if (snapTarget != _requiredSnapTarget)
        {
            return;
        }
        
        // Gather basic event data
        const string eventType = "Snap to Target";
        const string objectType = "Game Object";
        var objectName = gameObject.name;

        // Generate xAPI data with relevant fields
        var results = new XApiData
        {
            Comment = "Snapped to target!",
            Completion = true
        };

        // This sends the report
        Report.Send(eventType, objectType, objectName, results);
    }
}

Updated 8 months ago


Adding reporting to an Immerse scene


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.