How to track emails in Gmail

Learn how to track emails in Gmail. We will explore how to use an Email API to configure email tracking using Gmail.

hero banner for blog post


In this blog post, we dive deeper into tracking emails in Gmail. Email tracking is important because it allows us to understand how our readers engage with emails. If we better understand what emails are engaging, we can iterate and improve our email communication with existing potential customers. To learn more about email tracking, consider taking a look at what is email tracking. This technical post focuses on how to implement email tracking in Gmail.

Benefits to tracking emails in Gmail

Let’s go over the benefits of tracking emails before we take a look at how to track emails in Gmail.

Improving productivity

Tracking emails allows for better email communication management with respect to prioritizing responses. When we track email, we can determine whether the email is open and read, allowing us to take the necessary next steps, such as sending a follow-up email.

Gaining valuable insights

Learning about recipient engagement and behaviour toward your email communication is valuable to determine the effectiveness of email campaigns. Using this information, you can iterate and improve your messaging going forward and learn how to tailor your message to different audiences better.

Streamlining communication

Tracking email further streamlines communication with your users. For example, if a user reads an email, it may prompt a different follow-up versus an email that was left unread. In the scenario where an email was read by the user, such as a receipt or transaction, we may not require a follow-up email. If an email was unopened, we may want to prompt the user with a follow-up email.

Real-time email tracking

By learning about your user’s engagement with your email communication in real-time, you can build out certain follow actions relevant to a specific event. Real-time tracking is useful since the email will be relevant to the user as they have just engaged with it, such as opening it, reading it, or clicking on a specific link.

Why track emails in Gmail?

Gmail is ubiquitous as an email platform and is part of millions of businesses day to day workflow. Let’s look at use cases to track emails in Gmail.

Track sent emails in

We can track emails successfully delivered to the recipient’s email address. Tracking sent emails is important to ensure the message reaches our users. Tracking sent emails is an important part of improving email deliverability.

Track if email is read

Another way to track emails in Gmail is by checking whether the recipient has read the message. Knowing whether the email is opened is important when contacting the recipient with a follow-up for further actions.

Track email opens

Ensuring an email is opened is important to know if the recipient has engaged with the email message. Tracking email opens is important to understand whether the recipient accessed the email message. This is also useful for tracking as we can know the exact moment the recipient opens the email.

Link tracking

Another useful item to track is whether the user clicked on any links found within the email message itself. Another indicator of email engagement is the user finding the content useful and continuing to engage by clicking on the call to action found within the email.

Understanding Nylas for email tracking

Nylas powers your application’s email, calendar, and contacts. Let’s focus on our Nylas Email API for email tracking. We offer different ways of email tracking:

  1. The first method is a connected account where the user has authorized access to their email account to your application. We’ve covered how to track open email rates using the connected account approach.
  2. The second approach is where emails are sent using the Nylas Email API can be configured with tracking enabled. This way, you can track emails for any recipients, whether the email was opened, links clicked, or any replies in the thread.

The second approach to track emails does not require a connected account and provides real-time email tracking through the use of Nylas webhooks. We’ve covered how to setup webhooks with NodeJs and how to develop with webhooks locally using the Nylas Node SDK:

How to track emails in Gmail, step-by-step:

1. Setting up Nylas to track emails in Gmail

To get started with Nylas, consider using the Quickstart Guides to grab the code for sending an email, with environment setup details included. We provide Quickstart Guides in Python, Node, Ruby and Java. We recently covered using the Quickstart Guides on Coding with Nylas:

For the step-by-step guide, we will be using the Node SDK.

2. How to track sent emails in Gmail

In this section, we will look at tracking sent emails in Gmail. Let’s take a look at the code available in the Quickstart Guide to send emails in Gmail:

// Take frontend form data to send emails using Nylas SDK
 async (req, res) => {
   const {
     body: { to, body, subject },
   } = req;

   const user = res.locals.user;
   const draft = new Draft(Nylas.with(user.accessToken)); = [{ email: to }];
   draft.body = body;
   draft.subject = subject;
   draft.from = [{ email: user.emailAddress }];

   const message = await draft.send();
   return res.json({ message });

Given the above code, once the email is sent, we will receive a message that we can use to determine if the email was sent successfully. If a message was not received, we could check for error responses received. We can also update the code to handle error messages better:

try {
  // Add system logging for successfully sent message
  const message = await draft.send();
  return res.json({ message }); 
} catch(error) {
  // Add system logging for unsuccessfully sent message
  return res.json({ message: error });

In this section, we explored how to track sent emails in Gmail.

3. Track email opens

Let’s take a look at ways to track email opens. We’ve covered this in-depth in our blog post on how to track email open rates, where we also discuss checking open rates in Gmail and Outlook! Taking the above code sample from the Quick Start guide for sending emails, let’s modify the draft.send() to include tracking options for tracking email opens:

const tracking = { "opens": true };

// Send the draft with the email open tracking enabled passed in as an argument
const message = await draft.send(tracking);

This section explored how to track email opens in Gmail.

4. Link tracking

Let’s consider ways to track when a link is clicked. We are going to take the previously shared code sample for sending emails and modify the draft.send() to include link tracking:

const tracking = { "links": true };

// Send the draft with the email link tracking enabled passed in as an argument
const message = await draft.send(tracking);

This section explored how to track email links in Gmail.

Build time!

You can sign up for Nylas for free and start building! Nylas provides different approaches for tracking email engagement through connected accounts and real-time tracking using webhooks. Here are links to additional resources:

Consider building using our Quickstart Guides to accelerate your development and try out Nylas Email API tracking functionality.

You May Also Like

How to add Zoom to your event meetings
Nylas_Gartner Cool Vendor
Nylas recognized as a Cool Vendor in the Gartner 2023 Cool Vendors in Composable Customer Engagement Platforms
How to manage your Contacts using Reflex (Pynecone)

Subscribe for our updates

Please enter your email address and receive the latest updates.