I am trying to implement a custom Tracking Pixel for Emails sent out from wordpress.
Thanks to these post:
Tracking email with PHP and image
Tracking email opens with a real image
and especially
http://www.phpdevtips.com/2013/06/email-open-tracking-with-php-and-mysql/
I was able to implement the core idea.
The email loads the tracking pixel via
<img src="https://www.example.com/tracking.php?order_id=1" width="100" height="100" />
and in the tracking.php
$graphic_http = 'https://www.example.com/GIF-example.gif';
header('Content-Type: image/gif');
readfile( $graphic_http );
Opening the tracking.php file in a browser opens up the gif image for download.
However the Tracking pixel/Tracking image doesn't show up in the Gmail Email. There is only a broken image logo and when I click to show the image this link is opened
https://ci5.googleusercontent.com/proxy/l2xUKFGnNFKm64zEYmJhOcUmEJm15w9MC1txRRF01tpKlcL3t3O16aMJgbYQkucBySV0xV2T0EsCwikOAC0Z4em6uPzSs38lkHrYBvosRRAk14EfPoEXqC5JdLxRm8ToZmGSQqt_RwHCaBE_3uLgQDVEB05Rdtkq-Xzuw30=s0-d-e1-ft#https://www.example.com/tracking.php?order_id=1
which states a Google 404:
Google 404. That’s an error.
The requested URL /proxy/l2xUKFGnNFKm64zEYmJhOcUmEJm15w9MC1txRRF01tpKlcL3t3O16aMJgbYQkucBySV0xV2T0EsCwikOAC0Z4em6uPzSs38lkHrYBvosRRAk14EfPoEXqC5JdLxRm8ToZmGSQqt_RwHCaBE_3uLgQDVEB05Rdtkq-Xzuw30=s0-d-e1-ft was not found on this server. That’s all we know.
It seems to be a problem that Google's proxy cannot read the php script. Both the tracking.php and the GIF-example.gif files have 775 rights and are accesible publicly.
On Hotmail this does work so it really seems to be a problem with the Google Proxies.
Does anybody know how to let the Google Proxies access this Tracking pixel?
The Gmail app offers a protection feature against some tracking pixels. To enable this, here's the steps: Go to Gmail. Open Settings.
Click on the Mail tab and select Preferences. Click on the Viewing tab. Check the Load remote content in messages checkbox so that it's disabled.
There are a number of browser extensions that will also block the tracking pixels while alerting you to which emails contain trackers. PixelBlock is a simple Chrome extension that blocks images from loading and displays a red eye at the tope of messages when it detects a tracker.
I figured out the answer: The problem was with the Google Proxies and the question mark ? in https://www.example.com/tracking.php?order_id=1
The Google Proxies address got messed up because it already had a question mark and resulted in a 404.
I resolved it using https://www.example.com/tracking.php/order_id=1
instead and then on the tracking.php I didn't use $_GET
but $_SERVER['REQUEST_URI']
and parsed the /order_id=
String.
The tracking pixel shows up in Gmail and it gets tracked in the tracking.php script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With