Google Analytics is a popular web analytics service that tracks and reports website traffic. It offers insight about your user behaviour and allows you to make informed decisions regarding the evolution of your site.
The XR template that comes with the Unity package already includes Analytics as a part of the telemetry library used for collecting usage data but you'll need to set up a Google Analytics account and get a Tracking ID first, before using it.
Start by visiting Google Analytics and sign up for a new account:
Fill in the details of your organization and website. Remember to select https://
in the drop-down menu of the Website URL
field.
When you finish, click on Get Tracking ID
at the bottom of the page:
This will redirect you to the configuration page where you find the HTML code you'd use in the template:
Copy and paste this code as the first item into the <head>
tag.
Read Google Analytics' "Sending Data" documentation to learn how to use the gtag
API.
The amount of data in Google Analytics can be overwhelming to navigate and dissect. Fortunately, the folks at Google have developed a series of courses to explain you the main concepts of traffic analysis. We recommend you start at Google Analytics Academy.
There are a few open-source alternatives out there. Like Google Analytics, they are free although you need to host them yourself. We recommend Matomo and Open Web Analytics (OWA). Both offer geolocation, click-heat maps, traffic by referrer, event tracking, etc. Which specifically depends on your needs but you can compare both side by side visiting the demo pages for Matomo and OWA.