Email Tracking With Google Analytics and jQuery

Email tracking with Google Analytics and jQuery

Similar to setting up phone call tracking, now let’s set up an email tracking using Google Analytics and jQuery. We will make use Google Analytics event tracking to help us achieve this.

The requirement for this script to run successfully is to have the email wrapped in <a> tag with mailto: href.

Let’s say your email tag looks like below:

Now you can put the following script after you load Google Analytics and jQuery.

What does the above script do?

The above script listens to any <a> tag that is clicked. If there is any mailto: on the href on the <a> tag, it will fire Google Analytics event tracking under

  • Category: Email
  • Event: Click
  • Label: email address

If you have already decided with a certain tracking, you can change the code ga('send', 'event', 'Email', 'Click', phone); accordingly.

 

Leave a reply:

Your email address will not be published.