Wednesday, April 25, 2012

Email Tracking - GMail


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 GMAIL does not send a HTTP_REFERRER at all!



So I am trying to find another way of identifying when gmail requests a transparent image from my server. I get the following headers print_r($_SERVER); :




DOCUMENT_ROOT = /usr/local/apache/htdocs

GATEWAY_INTERFACE = CGI/1.1

HTTP_ACCEPT = */*

HTTP_ACCEPT_CHARSET = ISO-8859-1,utf-8;q=0.7,*;q=0.3

HTTP_ACCEPT_ENCODING = gzip,deflate,sdch

HTTP_ACCEPT_LANGUAGE = en-GB,en-US;q=0.8,en;q=0.6

HTTP_CONNECTION = keep-alive

HTTP_COOKIE = __utmz=156230011.1290976484.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=156230011.422791272.1290976484.1293034866.1293050468.7

HTTP_HOST = xx.xxx.xx.xxx

HTTP_USER_AGENT = Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10

PATH = /bin:/usr/bin

QUERY_STRING = i=MTA=

REDIRECT_STATUS = 200

REMOTE_ADDR = xx.xxx.xx.xxx

REMOTE_PORT = 61296

REQUEST_METHOD = GET



Is there anything of use in that list? Or is there something else I can do to actually get the http referrer, if not how are other ESPs managing to find whether gmail was used to view an email ?



Btw, I appreciate it if we can hold back on whether this is ethical or not as many ESPs do this already, I just don't want to pay for their service and I want to do it internally.



Thanks all for any implementation advice.



Update



Just thought I would update this question and make it clearer in light of the bounty.



I would like to find out when a user opens my email when sent to a GMail inbox. Assume, I have the usual transparent image tracking and the user does not block images.



I would like to do this with the single request and the header details I get when the transparent image is requested.


Source: Tips4all

2 comments:

  1. EDIT: Are your images requested with HTTP or HTTPS? That's the problem. HTTPS->HTTP referrals do not leak HTTP_REFERER. So, if you embed a HTTP hosted image in an email that is downloaded in HTTPS, it won't send a referrer. (HTTP->HTTPS, however, do). So, the solution is to host embed the image as HTTPS. I've tested it, and sure enough, secure HTTPS images do indeed leak the HTTP Referrer.

    So, there's no way Gmail could block the referrer information on loaded images by default, since Gmail isn't the one making the requests, the client is. The only way they could do it is if they used the HTML5 'noreferer' feature, which is not widely supported (I think recent WebKit-based browsers may be the only ones, as of this writing).

    See the below screenshot of an embedded image that is generated dynamically with the HTTP REFERER of the request:

    ReplyDelete
  2. Make the link something like http://www.example.com/image.jpg?h=8dh38dj

    image.jpg is a PHP file and 8dh38dj is the hash of the email you included the link in. When the user requests the file, your PHP script will get '8dh38dj', look that up in your database and find the matching email. Parse the domain i.e. gmail.com from example@gmail.com and you know it is from gmail. To make jpg files execute as PHP, use an AddHandler in php

    ReplyDelete