Skip to content

Application Insights for Unity. Track scene user flow, Unity UI button and Mixed Reality interaction events

License

Notifications You must be signed in to change notification settings

Unity3dAzure/UnityApplicationInsights

Repository files navigation

Analytics for Unity with Azure Application Insights

This is a sample Unity project showing how to track button events and Mixed Reality event telemetry using Application Insights.

Setup

  1. Create new Application Insights service in Azure
  2. Copy and paste your Application Insights Instrumentation Id into the Application Insights Unity scene script.
  3. (Optional) You may also wish to add your App Id and (read only) Key for running Application Insights Query scripts.

How it works

Add one instance of the UnityApplicationInsights scripts into your main Unity scene.

  • Unity scene changes are automically captured as a PageView event.

  • To add logging to Application Insights for Unity UI buttons you can either manually attach the ButtonTrackerBehaviour to the Unity button, or enable the Add Tracker Behaviours setting in the Inspector which will attach the script automatically to all selectable game objects upon scene change.

Application Insights sample scenes

Scene name Description
Scene-UI Unity UI Button event telemetry sample scene
Scene-MR Interactive hologram event sample scene for Mixed Reality

Application Insights visualisations

In Application Insights Usage section you can visualise telemetry logged from your app.

User Flows

Chart user flow across Unity scene changes and split by custom or interaction events.

App Insights User Flows

Sessions

View users and events during sessions.

App Insights User Sessions

Funnels

Create funnels by creating step by step conditions to get conversion rates.

App Insights Funnels

Retention

Review returning users over a period of time.

App Insights Retention

Custom visualization of Unity UI and MR telemetry

To create custom visualizations using all the data collected by Application Insights you can use the Ibex Dashboard. Fork the project and copy the Unity UI template or MR template file into the server/dashboards/preconfigured directory. You should then be able to create your own dashboard by using these templates in the app.

Custom Dashboard for Unity UI interactions

Custom Dashboard for Unity MR interactions

Dependencies

Json.Net is currently required to serialize Dictionary objects in Unity.

Optional dependencies

Optional dependencies are included as git submodules which can be installed after cloning:

git submodule update --init --recursive

The Voronoi selection sample code is commented out inside the Scripts/MR/Tap.cs script.

Voronoi selection is useful in Mixed Reality scenarios for selecting holograms which may be small and close together or even overlap. In relation to capturing telemetry in MR scenarios we might want to capture Air Taps on holograms. But what happens when a user taps on void spaces which may have missed the target. We can log any useful metrics regarding nearest objects to Application Insights or even enable the closest object to be triggered.

Removed dependencies

I decided to remove the dependency on the Application Insights Plugins as it only supported Windows devices.

Related documentation

Related projects

Releases

No releases published

Packages

No packages published

Languages