1

I've been working on open tracking by attaching tracking pixel to an email which is sent via PHP web application that I've been developing. The first problem I encountered was marking email as open just it was sent. I found help here: False open trackings using SES and gmail where I found link to the article describing how to prevent triggering opens by Google bot by checking user agent. I created the following function to check if I deal with the bot:

function isGoogleBot(string $userAgent): bool
{
    $googleBotUserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246 Mozilla/5.0';

    return $userAgent === $googleBotUserAgent;
}

I also read some articles about caching images by Gmail but unfortunately I'm still dealing with some problems.

I did the following test in Chrome, Firefox, Edge and Safari:

  1. I sent an email via application that I've been working on and then opened it in Gmail web client.
  2. Then I went to the application to see open tracking statistics.
  3. I repeated above test twice to make sure every time I get the same result.
  4. With the last email I checked what is happening with subsequent opens of the same email.

Here are my observations:

  • In every browser except Firefox when I open email for the first time an extra open is being made so I see 2 opens in the statistics. In Firefox only 1 open is numbered.

  • On subsequent opens only 1 open is being added to the total opens
    statistics every time I open the email. The exception is also Firefox where total opens counter is not changing. No matter how many times I open the email the total opens count is equal 1.

Is there any solution how to make reliable open tracking in every browser when email is opened in Gmail?

0 Answers0