Is it as simple as adding onclick=”ga(‘send’, ‘event’, ‘Category’, ‘Action’, ‘Label’, ‘Value’);” to my links in order to track click events?

Viewed 1252

I want to track outbound link clicks on my site. I have Google Analytics on my site in terms of having the global site tag (gtag) in the head.

I'm happy to add the onClick event to each link as there's only a few. Can I just add onclick="ga('send', 'event', 'Category', 'Action', 'Label', 'Value');" to each link?

Basically I just tried this and the events are not showing in the Realtime stats so I'm not sure if I'm missing something.

1 Answers
Related