Tagged: event tracking, google analytics
Hi team,
Hoping you can help. We’re using Google Analytics to track traffic at our domain. We’ve set up a goal conversion using goal type: Event — ideally to track click events throughout our site. Using the Google Chrome Tag Assist extension, we see that it’s not actually tracking, though we can’t figure out what is incorrect about the set up.
This is the page we’re testing the goal conversion on:
The code is <a href="https://aegiseasy.com/" onClick="ga('send', 'event', 'signup', 'mainnavclick');">Sign up</a>
On the Google Analytics side, the goal set up looks like this: https://www.dropbox.com/s/do5p9ifyote98bj/Screen%20Shot%202020-10-02%20at%2012.28.10%20PM.png?dl=0
We’re using UA, not tag manager.
Hey jaimemerz,
Thank you for the inquiry.
We are getting this error in the console whenever we visit the page.
Uncaught ReferenceError: gtag is not defined
<anonymous> https://site.com/ga-test/:109
The error is from this inline script.
<script>
gtag('event', 'mainnavclick', {
'event_category' : 'signup',
});
</script>
Do you intend for the link to redirect to a different page? If not, you may also need to use the e.preventDefault function so that the link does not actually open the assigned link.
// https://www.w3schools.com/jsref/event_preventdefault.asp
Best regards,
Ismael