0

In order to track email open rates, I'm firing a pixel in a mass email I'm sending from my server. The script is working in Mac Mail. The email is received and the pixel is downloaded.

However, it's not working in the Yahoo mail client. The email is received, the referenced images are downloaded and shown, however the pixel does not fire/download, nor does the php script run (to my knowledge). Does anyone know why this would happen with Yahoo mail client and potentially other clients that I have yet to test?

Here is the html img tag:

<img src="http://mysite.com/email_track.php?email=email_value&country=country_value&state=state_value" />

Here is the php script:

<?php


// Database code omitted

$result= mysql_query("INSERT INTO `CelebrationOpens` SET `time` = NOW(), `country` = '$country', `state` = '$state', `email` = '$email' ") or die(mysql_error());

// Create an image, 1x1 pixel in size
$im=imagecreate(1,1);

// Set the background colour
$white=imagecolorallocate($im,255,255,255);

// Allocate the background colour
imagesetpixel($im,1,1,$white);

// Set the image type
header("content-type:image/jpg");

// Create a JPEG file from the image
imagejpeg($im);

// Free memory associated with the image
imagedestroy($im);

?>

I've also tried to fire the pixel like this:

$name = './concert/pixel.png';
$fp = fopen($name, 'rb');


header("Content-Type: image/png");
header("Content-Length: " . filesize($name));

fpassthru($fp);
exit;
Micah
  • 1,548
  • 14
  • 23
  • 1
    image blocker is my guess. Many/most email programs can block images because of this unless a user accepts images. – Class Nov 05 '13 at 06:35
  • @Class I don't think that is a possibility because other images are showing up in the email. I'll edit my question to clarify that. – Micah Nov 05 '13 at 14:00
  • First thing I'd check is your web server logs. If the other images are downloading ok, then your web server logs will include hits for them. Do the logs also include a hit for the tracking pixel? If no, then the client is never requesting it. If yes, then is the return status 200? – Alex Howansky Nov 05 '13 at 16:27
  • @AlexHowansky what would the image be named in the logs if I'm creating it with the imagecreate() function? – Micah Nov 05 '13 at 19:14
  • It will log the requested URL -- so look for `email_track.php`. – Alex Howansky Nov 05 '13 at 19:32
  • @AlexHowansky I checked the logs. I'm confused by what I found. When viewing the email from ymail or gmail web clients, neither the regular images nor the pixel email_track.php is getting requested in the logs. Though for both, the regular images are shown in the browser. With Mac Mail, the images and email_track.php are listed as 200 in the logs – Micah Nov 06 '13 at 03:59
  • 1
    Maybe they're caching the pixel image? Hit the pixel URL with `curl --head http://...` and see what headers it's sending. – Alex Howansky Nov 06 '13 at 14:19
  • @AlexHowansky curl response is: HTTP/1.1 200 OK Date: Wed, 06 Nov 2013 15:41:00 GMT Server: Apache/2.2.22 (EL) Vary: Accept-Encoding,User-Agent Content-Type: image/jpg – Micah Nov 06 '13 at 15:41
  • Try explicitly disabling caching in your script for the pixel image? See [this page](http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers). – Alex Howansky Nov 06 '13 at 18:23
  • @AlexHowansky good suggestion, I added the cache disable and same result, no pixel fire. – Micah Nov 06 '13 at 19:20

2 Answers2

0

You mentioned you are using all embedded images, which is why they always show, independently of whether you opt to download images for your email. Embedding images is the workaround for image blocking, but results in a large filesize for the email.

All non-embedded images need to be shown to work. Your tracking pixel is one. Apple clients download all images by default, while other clients do not. The tracking image is not firing because you haven't downloaded images on your email in Yahoo (or any other client).

Unfortunately this is a limitation to open tracking and why the data is incomplete and always skewed towards Apple clients. Open tracking really means 'They opened it and unblocked the images OR They opened on Apple'.

John
  • 11,205
  • 3
  • 41
  • 59
  • I probably used the wrong word by saying "embed". My images are tags with urls refs. My yahoo client "downloaded" all the images after I clicked "Show Images". I would think the pixel should fire once I cleared all the images for download. – Micah Nov 05 '13 at 16:17
0

I was able to find the culprit, and it was related to caching the pixel link. I appended a random string to the img src and it works in both ymail and gmail now.

The image tag now looks something like this:

<img src="http://mysite.com/email_track.php?email=email_value&country=country_value&state=state_value&random_value=<?php echo rand() ?>" />

Thanks for the help in guiding me towards this discovery.

Micah
  • 1,548
  • 14
  • 23