Skip to content Skip to sidebar Skip to footer

Google Analytics _trackevent Not Working

I am trying to track each menu on the website using _trackEvent of Google analytic. So far Analytic is working fine but Event Tracking is not working. Below is the code i am using

Solution 1:

Check under the real-time reports is it showing up there. Remember that it can take up to 24 hours for the data to show up in the standard reports.

Your code should look something like this:

<ahref='#'onclick="ga('send', 'event', 'button', 'click', 'test', 4);"> Test Event</a>

This page should help you understand how it should look Event Tracking - Web Tracking (analytics.js)

Add a comment if this doesn't help. See if i can help you get it working how you want.

Solution 2:

It's not recording the event because you are sending them to another page before the event tracking in Google Analytics has a chance to record.

See Track outbound links

This will show you how to set up a function that allows the event tracking to be sent to GA before the user is sent to another page.

Solution 3:

There's two possible reasons why this might not work: (1) Code has a bug in it, or (2) Its not actually sending to GA (3) Goals not set up

I can't see anything wrong with it, so I'm going to skip over number 1.

You may want to get a GA debugger and work from there to see what is happening. If you have an analytics blocker, I recommend turning it off. Also, the data won't appear immediately. Google has the little habit of filtering data before it is presented to you.

For your goals, make sure you are actually capturing the information. I've made this mistake before. I set up the event tracking, wait for the events... and they never come. You'll have to set up a goal in GA to listen for this.

Post a Comment for "Google Analytics _trackevent Not Working"