Our zoo app is done! Now we want to track which buttons are pressed to see what the most popular exhibits are. As before, click on the cloud icon to access the service menu. then turn on analytics, I already turned it on but there’s one final step of pressing play to send some test data to Unitys servers to validate the connection with them.
The next step is to open the package manager and search for the analtyics library in Unitys registry and install it.
attach the analytics event tracker script to all the sign buttons. Fortunately, you can do this in bulk!
Change the When option to UI for each button and give each button event a corresponding name:
Then for each button, add a new onClick event, drag the button into the onClicks source slot, and select analytics/triggerEvent(). Your button is now wired for analytics!
We can now call up our dashboard through the analytics popup window, it will open a new webpage where we can track our app. Currently it’s empty, but we’ll soon start pressing some buttons and populating the screen.
Unfortunately, Unitys validator is deprecated in 2020 and a little research says it takes a little time for events to show up in the viewer. Hopefully a new real-time method will become available by the time of this writing but this is a proper example of getting your buttons hooked up to analytics! Hope it helps!