Track 'Emails Received' with GA4 Instead of Just 'Email Address Clicks'

Websites that provide direct email contact options are seen to rely on email address clicks to measure leads, but they fall short of confirming if an email was actually sent. This can lead to skewed data and misguided marketing efforts. We propose a more precise tracking system using the GA4 Measurement Protocol so marketers can differentiate between mere clicks and actual contact.

Would you rather measure when you receive an email?

Websites often display contact email addresses directly on the page. Many users prefer clicking on these email addresses and writing an email rather than filling out a form. However, tracking conversions through these contact email addresses usually relies on a proxy metric like “clicks on the email address”, which is inaccurate and includes unintended clicks that never convert.

A click on your contact email address only implies that the user intended to get in touch with you, but it doesn’t confirm if they actually did. So, what’s the solution? Can you send an event to Google Analytics only when somebody really sends the email? Yes, it is possible! ???? 

We propose using GA4 Measurement Protocol for enhanced tracking to send events when you receive contact requests via direct emails rather than just tracking clicks on your email address. This doesn’t mean you shouldn’t track the latter; tracking email address clicks can still enhance your funnel visualization.

Moving towards Accurate Measurements

Emails received are just like contact form submissions—they represent genuine customer interest. Your conversion tracking becomes significantly more accurate when you can account for all methods by which a customer contacts you. For instance, tracking phone calls is another challenge that we might cover in a future post. If you’re not including users who send you an email in your audience or conversion calculations, you’re missing valuable opportunities.

Relying solely on email address clicks includes unintended clicks or clicks that never materialize into actual contact, leading to incorrect and misleading marketing funnel statistics. This inaccurate data can distort your understanding of customer behavior and hinder effective decision-making. By tracking ’emails received,’ you ensure that your metrics reflect real engagement, allowing you to make better-informed marketing decisions.

Requirements

To implement this solution, we recommend using Zapier or another automation platform. Here’s what you’ll need:

  1. Access to Website code:  To add JavaScript code to your pages where your contact email addresses are mentioned.
  2. GA4 Admin Access: To generate an API secret for Google Analytics 4 Measurement Protocol in your Google Analytics account.
  3. Zapier Pro Plan: For using multi-step Zaps. A Free Plan can work for a simple implementation (2-step Zap), but it has its limits.

It’s important to note that Measurement Protocols work best with an accurate Google Analytics Client ID. While it is possible to create a random number and pass it as the Client ID, this would only pass a detached, isolated event with no connection to any events generated by this user earlier. To ensure accuracy, it’s best to pull the user client ID and pass it in your events. That way the entire behavior of this user is tied together.

Approach / Methodology

This implementation consists of three main parts:

  1. Identifying direct emails and isolating emails received from clicks on the email address mentioned on your webpage and others
  2. Capturing and Passing GA4 Client ID when an email is received (to identify the user session and attach this event to all previous events from this user)
  3. Sending the event to GA4 when you receive an email

Let’s look at each step one by one.

Identifying Emails

To identify the emails received from clicks on your webpage’s email address, you have two options:

  1. A Unique Email Address: Create a new mailbox specifically for this purpose, such as [email protected]. Any email sent to this address is assumed to be from users who found it on your website. This email address should not be used for other communications.
  2. A Forwarding Mailbox: If creating a unique email address is not feasible, add a forwarding rule to your existing mailbox. Channel the emails generated from webpage clicks by adding a unique subject line. Set up an email rule to identify specific words in the subject line or email body and forward these emails to a Zapier mailbox for further processing.

Extracting and Passing the Client ID

To pass the client ID in the event, it must be included in the email. Here’s how:

  1. Extract the Client ID from the GA cookie.
  2. Include it in the email body or subject line when a user clicks on the email address.
  3. Ensure that the user does not alter the Client ID by adding clear instructions like “Please do not delete this.”

Sending the Event

Once you have the Client ID included in an email and a mailbox set up in Zapier, follow these steps:

  1. Parse the Email: In Zapier, set up a trigger to parse the incoming email (Step 1).
  2. Send to GA4: Create an action to send the event to GA4 (Step 2). You will need an API secret and Measurement ID from your Google Analytics 4 account for this step.

Step-by-Step Implementation Guide

Step 1: Extract GA4 Client ID

We first write a function to extract the Google Analytics Client ID. This function checks for the cookie. The GA4 Client ID is stored in a first-party cookie called _ga. Here is how the function looks:

function getCookie(name) {
    let cookieArr = document.cookie.split(";");
    for(let i = 0; i < cookieArr.length; i++) {
        let cookiePair = cookieArr[i].split("=");

        if(name === cookiePair[0].trim()) {
            return decodeURIComponent(cookiePair[1]);
        }
    }
    return null;
}

Now, when you call getCookie('_ga'), it will retrieve the GA4 client ID for you.

Step 2: Pass GA4 Client ID in the Email

We write a function to pass the Client ID to the email draft that opens when a user clicks on our contact email address. To ensure users do not interfere with the client ID, we pass it in both the subject line and the email body.

Here is the function:

Don’t forget to replace red highlighted lines based on your preference

function generateRandomNumber() {
   return Math.floor(Math.random() * 1000000); // Generate a random number between 0 and 999999
}

function setMailtoLink() {
   const gaClientId = getCookie('_ga');
   if (gaClientId) {
       const strippedClientId = gaClientId.replace(/^GA1\.1\./, ''); // Remove the "GA1.1." prefix
       const emailLink = document.getElementById('email-link');
       const randomNumber = generateRandomNumber();
       const subject = `Contact Request #${randomNumber}`;
       const body = `------------------------------------\n\nPlease do not delete this.\n\nYour request ID: ${strippedClientId}`;
       const recipient = 'Your Company Support <[email protected]>'; // Update this with your email address
       emailLink.href = `mailto:${encodeURIComponent(recipient)}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
   }
}

Step 3: Set Up Zap Mailbox in parser.zapier.com

  1. Go to parser.zapier.com and log in using your existing Zapier login or create a new account.
  2. Create a new Mailbox.
  3. Copy the email address given and save it.

Step 4: Add Email Forwarding to the Zap Parser Mailbox

  1. Go to your email server and add an email forwarding rule. In our example, we use Gmail.
  2. Create a filter for all emails that contain “Contact Request” in the subject line and the words “Your request ID:” in the email body.
  3. Forward these emails to the email address copied from the Zapier Parser.

Step 5: Send a Test Email

  1. Add the above JavaScript to your testing server (if you have one).
  2. Click on your contact email address. Your default mailbox client will open an email draft.
  3. Ensure you see the Client ID and subject line getting populated automatically.
  4. Add some dummy text to the email draft and send it.
  5. Check your email in the Parser Mailbox you set up. Refresh if necessary.

Step 6: Get Your API Secret and Measurement ID

  1. Get your GA4 Measurement ID from GA4 Admin > Data Streams.
  2. Get your API secret from GA4 account settings. Go to Data Streams > Measurement Protocol API Secrets and create a new API secret. Check here on how to do this →

Step 7: Set Up Your Zap

Trigger: Select App Email Parser by Zapier. Select the mailbox and test. You should see the client ID as a data input.

Action: Select Google Analytics 4 and “Send Measurement Events for an Application in Google Analytics 4” as the Zap event.

  1. API secret: Paste it here.
  2. Measurement ID: Paste it here.
  3. Client ID: Select from the Trigger step where you parsed the email and extracted Client ID.
  4. Event name: Add parameters if necessary.

Here is how you can write the event name.

Don’t forget to replace red highlighted lines based on your preference

{
  "name": "email_received", //This is the event name that'll show up in GA4
  "params": {
    "param_1_name": "param_value_1",
    "param_2_name": "param_value_2",
    "param_3_name": "param_value_3"
  }
}

If no parameters are needed:

{
  "name": "email_received", 
  "params": {}
}

Send a test and check the event in your GA4 Realtime report.

Measurement accuracy helps you to make informed decisions and optimize your strategies effectively

The entire setup might seem overwhelming due to the length of this article, but rest assured, implementation is straightforward. What we have outlined is a step towards more accurate measurement, enabling you to make informed decisions with greater confidence.

In this guide, we’ve demonstrated how companies can use real email sends by their users to trigger events in Google Analytics 4, marking them as conversions. This approach can be further refined by adding smart filters to avoid spam emails. By moving away from proxy metrics like “clicks on contact email address,” companies can accurately count users who actually get in touch. Additionally, combining click tracking with the offline measurement of received emails provides a comprehensive funnel visualization, showing how many people follow through after clicking the email address.

Further work is needed to measure similar events for phone calls, but this implementation is a significant step forward.

We hope you found this guide useful and are excited to implement it on your landing pages. If you need any assistance with the implementation, we’re here to help!

Note that since this is an offline event, standard parameters like page URL or page title are not automatically attached. If you want to include these parameters, you will need to send these values as part of the email body. Then, store them as variables in the email parser (just as we did with the Client ID) and use them in the parameters for the GA4 event inside the Zap.

0 Comments

    Leave a Reply