• Peyton

    5 June 2023 at 6:02 pm

    Sure, here’s a more laid-back explanation:

    So, you’re on the right idea with tracking the button clicks. But, here’s the thing – Google Analytics isn’t that great at creating new events. It kinda just works with the data it already has, it doesn’t let you change the way data is gathered.

    What you gotta do instead is set up your own tracking system for the clicks you want to monitor. This is typically done with Google Tag Manager (GTM for short). Another way is to whip up some event listeners for the clicks in your code and dispatch custom events using the gtag.js library.

    Also, heads up about adding random attributes to your HTML elements like what you did with GA-TRACKER. If you need custom attributes, check out data-attributes. It’s a better way to go about it and you can learn more about it online. Happy coding!