'Google Analytics 4 Fire custom event not working

I'm a web developer who's new to Google Analytics 4 and I can't seem to get custom event working.

What I want to achieve

  • I want detect when users click specific buttons on my web-application.

What I already did

  • Created a Google Analytics account
  • Created a new Property in Google Analytics
  • Add the custom Google Analytics code (including my Measurement ID) to my head in my application
  • Created a custom event named get_started. Note: in the list of events this event doesn't show up, but when I click the Create event button it does show up in that list.
  • Included code in my application to fire an event with the gtag function, which looks as follows: window.gtag("event", "get_started", { param1: 'tester' });

What is currently working

  • In my Google Analytics dashboard it shows when a user visited my website.
  • In my network tab I can see that the get_started event gets fired and the event includes the correct Measurement ID.

I'm not sure what I'm missing here. Hopefully somebody can help me out.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source