Google Analytics events are not being register on dashboard

Hello, anyone know how to track events from playcanvas?
Im already using google analytics and i can track when users open the web, but i cant find a way to track when the click buttons.

Thanks and Best Regards

Are you calling Google events when users click on the PlayCanvas UI element buttons?

Hello
I tried adding ga(‘send’, ‘event’, ‘ButtonRed’, ‘click’, ‘score’); to the html of the button, but i cant make it work.
Not sure if thats the way to add it on Playcanvas or is any other method to do it.

thanks

Are you using the UI elements in PlayCanvas or HTML for your UI?

Im using both UI elements from playcanvas and HTML, i dont know how to enable tracking for the UI elements from playcanvas, and im only trying to enable it on HTML elements.

It seems like you are doing it right by calling the function on the click event of the HTML element.

For PlayCanvas UI elements, it’s pretty much the same thing. Call ga on the click event callback.

Have you checked this in the browser debugger and added breakpoints to the ga lines to ensure they are called?

Can you create a small example project and/or provide example code on how you are setting up the callbacks?

Hello
this is my project right now https://playcanv.as/p/jUptIsxJ/

im going to try ensure that they are called

@Arthur I’m looking at the scripts and I can’t see where ga being called anywhere?

Hi im attaching the scripts that im using, im not sure if there are correct

You need to add the ga call to be on the onclick callback of the element. See https://www.w3schools.com/jsref/event_onclick.asp

I assume that these some JavaScript already to react to the user pressing the button? If so, add the ga function call there as well.