I've set Analytics for my new landing page. Everything works correctly( real-time data as well) except for Events tracking.

Actually, this is the first time I'm working with Analytics Events tracking, it looked so easy to set up at the beginning but now I'm lost.

I've searched for tons of information on the internet and followed many different instructions but I still can't get it to work.

This is how my set up looks like:

Inside my header:

  <!-- Global site tag (gtag.js) - Google Analytics -->
  <script async src="https://www.googletagmanager.com/gtag/js?id=*mytrackingid*">
     window.dataLayer = window.dataLayer || [];
     function gtag(){dataLayer.push(arguments);}
     gtag('js', new Date());

     gtag('config', '*mytrackingid*');

onCall handler:

"gtag('event', 'Test1', {'event_category': 'Test2''});"

I've tried using "ga()" as well with no results.

I'm really stuck here.

PS: I have no filters on my Analytics view.

1 Answer 1


You are missing "send" syntax, that is the reason. Here is an example

ga('send', 'event', 'eventCategory*', 'eventAction*', 'eventLabel' , 'eventValue');

gtag('event', 'Action', {
  'send_to': 'GA_ID',
  'event_category': 'Category',
  'event_label': 'Label'

Event category and action are required, label and value are optional. Try that, also i have to ask you, why you do not use Google Tag Manager, you said that you are new to this, it will be easier for you and your site performance, it is my warm suggestion, but the decision is all yours.

  • 1
    The pieces of code I've used for the eventFunction we're all taken from answers to my question, but none of them has worked. I'm glad to be back making questions on Stack! Why do you think Google Tag Manager has better performance? Thank you very much!
    – Giamme
    Mar 20, 2019 at 10:09
  • Sorry to hear that. Google Tag Manager is a tool that, fires Tags (Google Analytics events, Page-views/ Google Ads and many other marketing tools) By command ( Triggers) That mean you have only one script on your website to rule them all. And what is important you have to put the GTM snippet only once and that is it, you do not have to touch it anymore, everything else you can configure through interface in GTM. Conclusion: Less JS on source code better performance and easier to deploy events and other tags. Also you can check your set up anytime with only preview button.
    – Filozof666
    Mar 21, 2019 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.