Email Tracking - Apple Mail

2.2k views Asked by At

I have asked a similar question to this but for GMail and I was greatly satisfied with an awesome answer I received. However, I am having trouble with another email client: Apple Mail.

I am creating my own email tracking system for email marketing tracking. I have been able to determine each persons email client they are using by using the http referrer but for some reason Apple Mail like GMail does not send across HTTP_REFERRER. For GMail the solution was to use https for where I hosted the transparent image but this hasnt worked for Apple Mail.

print_r($_SERVER); only gives this sort of header:

WM_UCONTROL_XMLRPC_SERVER - http://aaaaaaaaa

HTTPS - on

ACCESS_DOMAIN - aaaaa

DATABASE_SERVER - aaaaaaa

SITE_ROOT - /home/121000

SITE_CGIROOT - /home/121000/cgi-bin

SITE_HTMLROOT - aaaaaa

PHPRC - aaaaa

HTTP_X_FORWARDED_HOST - aaaaaaa

HTTP_X_FORWARDED_SERVER - aaaaa

HTTP_X_FORWARDED_FOR - aaaaaa

HTTP_HOST - aaaaaa

HTTP_CONNECTION - close

HTTP_USER_AGENT - Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; en-us) AppleWebKit/525.18 (KHTML, like Gecko)

HTTP_ACCEPT - */*

HTTP_ACCEPT_LANGUAGE - en-us

HTTP_ACCEPT_ENCODING - gzip, deflate

SERVER_SIGNATURE - <address>Apache/2.2.9 Server at aaaaaaa Port 443</address>


SERVER_SOFTWARE - Apache/2.2.9

SERVER_NAME - aaaaaa

SERVER_ADDR - aaaaaa

SERVER_PORT - 443

Please note, certain details where hidden with a string of a.

Is there any other way I can find out when the Apple Mail client requests this image?

As a side note, this is when I wish SO had a way to invite certain users to questions as yc was a great help last time!

2

There are 2 answers

6
alex On BEST ANSWER
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; en-us) AppleWebKit/525.18 (KHTML, like Gecko)

You could check to see if that user agent will match to Apple's Mail only (i.e. not Safari or other Apple WebKit implementations).

0
Sripathi Krishnan On

Here is what I would do -

  1. First, the image link for each email address should be unique. Something like pixel-.jpg. The should somehow encode the users email address.
  2. Track the user-agent that's sent as part of the http server.
  3. If you get the referrer header and can parse it, great. If not, the user-agent can help.
  4. If user-agent indicates a browser, figure out the email client from the email address. For example, if the email is [email protected], you know its web gmail.
  5. Google and other companies also provide hosted email. So, if user agent indicates a browser, and the email address is [email protected], there is still a chance the email client is gmail. To find out more, you can look up the MX records for mydomain.com. If the MX record has google or googlemail in it, you know you are dealing with gmail. Same approach can be used for other email hosting companies.
  6. If it is a desktop based client like outlook or thunderbird, the user agent will usually indicate this.

Generally, email clients automatically block external images, so this approach will only work if the user allows image loading for your email address.

A usual trick is to have the token in an image, as well as on all links in the email. Then add a line "If you cannot view this message properly, click here". If the image is allowed, great. Otherwise the user won't be able to read your message, and will likely click the link. Either way, you get the user-agent and the hash-token.

.. But if the user doesn't allow images and doesn't click the link, there is no way to track if the user actually read the email.

Final Tip : Use the WURFL library to decode the user agent. Its the best library out there.