Google Analytics Event Tracking Code

May 15th, 2015 | SEO

If you want track events or users behaviour on your website then this tutorial helps you to setup event tracking or conversion goal.

There are two type of tracking code available in google analytics Universal and Asynchronous Syntax. Make sure to use universal tracking type otherwise the event tracking won’t work.

Here we are going to use universal tracking (ga.js) type and HTML Event Handlers

onClick=”ga(‘send’, ‘event’, ‘Contact’, ‘Quickquote’, Clicked, 1);”
Where: Contact is the category Quickquote is the action Clicked is the label 1 is the value Insert this link on your web pages.
<a href=” http://www.yourwebsite.com/contact.php/ ” onClick=”ga(‘send’, ‘event’, ‘Contact’, ‘Quickquote’, Clicked, 1);”>Contact</a> Event tracking won’t work until you setup Events in Google Analytics As Goals. Follow the steps to setup events as goal.

  1. Login to Google analytics.
  2. Select the profile you want to create tracking events.
  3. Under admin link, Click the + New Goal button.
  4. Assign unique name to your goal. Under dropdown menu select “Event
  5. Enter the category, action, label and value in same order.
  6. That’s all.

To test the event is working go to the page where you setup the event. Click on it. Go to Google Analytics real time view and look at the conversions page. If you followed everything correctly you will see the event / conversion you just setup appear.