I am trying to create a tracking pixel that will log email open time in my database. I do this by calling the php link in the URL path.
<img src="http://example.com/lp/index.php?p=tp&ord=xxxx" />
Then in my controller I have a code that records the time, followed by this bit of code, which reads a 1x1 image and displays it on the screen.
$fileOut = 'inc/sections/common/tpixel.jpg';
header("Content-Type: image/jpg");
header('Content-Length: ' . filesize($fileOut));
readfile($fileOut);
This works as expected if the img tag is placed in the HTML of the webpage and the webpage is viewed in the browser. However, when I put this image tag in an email and view it using gmail, the time stamp does not work and the image does not appear. It just returns a 404 error.
Any ideas as to why the image view in gmail will return not found? Isn't that the best way to do this? This is my first attempt at pixel tracking.
Also note that I click on the images of the show in the email to activate it.
source
share