analytics | seo

Event tracking with Google Analytics

When you want to get metrics related to user interactions on various parts of your website Google Analytics (ga)  event tracking can be helpful and is easy to integrate as well.

Abhith RajanAugust 17, 2017 · 2 min read · Last Updated:

I hope you have already added google analytics tracking script in your master page. If not see the page source of this page and check at the bottom of the page, there you can see some script which is provided by google analytics when we add a website (property) to our account in Google analytics which will track the page views etc for the whole website.

To add event tracking, we need to trigger the following function,

1ga(
2 "send",
3 "event",
4 [eventCategory],
5 [eventAction],
6 [eventLabel],
7 [eventValue],
8 [fieldsObject]
9);

In which,[eventCategory] and [eventAction] are required fields.

Example usage follows,

1<a
2 href="tel:1800123456"
3 onclick="ga('send', 'event', 'Phone Call', 'Click/Touch', 'Contact Page');"
4 >1800123456</a
5>

The above code will track user interaction with the phone number. As you can see, here the eventCategory is “Phone Call”, and eventAction is “Click/Touch”. We can use the eventLabel field to improve the metrics by like here is assigned with value “Contact Page” so that we knows how much triggered from that page itself. And for other pages, we can have different eventLabel.

Written by Abhith Rajan
Abhith Rajan is an aspiring software engineer with more than 8 years of experience and proven successful track record of delivering technology-based products and services.
Buy me a coffee

Was this helpful?

Show some ❤️

Share this page on Twitter to appear on the webmentions* 💡

This page is open source. Noticed a typo? Or something unclear?
Improve this page on GitHub

Related StoriesView All

Related Tools & ServicesView All

woorank.com

Website Review Tool & SEO Checker

Instantly review your website for free with the WooRank SEO Checker! Find issues, track keywords, identify opportunities & create reports. 14 day Free Trial.
seobility.net

SEO Checker | Test your website for free with Seobility

Instantly review your website for free with the SEO checker from Seobility and get tips for a better search engine optimization and higher rankings.