Basic Custom Event Tracking with Google Tag Manager and Analytics

I'm attempting to get a (in my opinion) very simple scenario working with Google Tag Manager and Analytics, and running into problems.

  • We have made a new Google Analytics (GA) universal analytics site.
  • We have made a new Google Tag Manager (GTM) container for our site.
  • We created a "tag" in GTM for our GA account, firing on "All Pages" to track page views.

Now we would like to track events using custom JavaScript, via the dataLayer. For example:

$('a').click(function() {  
  dataLayer.push({'event': 'linkclickedtest'});
}); 


This just isn't working, at all. If I watch Chrome's console/network tabs, no data seems to get sent to Google. I've also installed the Google Analytics debugger for Chrome and it doesn't show the event firing either. I must be missing something simple. Any guidance would be appreciated. Thanks!

Answers

You need to create a new GTM trigger based on the linkclickedtest event. Your tag should then be configured to fire on this new trigger.

Posted on by nyuen

Relevant tags