the MMM blog

How to setup Email tracking pixel

How to setup Email tracking pixel


An email tracking pixel is a transparent image, measuring one pixel by one pixel, that can used for tracking opened rate or click through rate. The image looks like:

<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">

Or if you need a black one

<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=">

 

So in your website, you need to have a url which returns the above image.

In MVC, you can have a controller like:

public FileContentResult Track(string trackingid="")
{
   // process your trackingid
...
   string gif1x1 = @"R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
   return new FileContentResult(Convert.FromBase64String(gif1x1), "image/gif");
}

In PHP,

header('Content-Type: image/gif');
echo base64_decode('R0lGODlhAQABAJAAAP8AAAAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==');

 

Then put the URL in your email template, something like:

<img src="http://yourdomain.com/controller/track/[trackingid]" style="display:none"/>

 

So the image is 1px by 1px transparent image which won't affect your template, but you can start processing the tracking id on your website. The same method can be applied to button click as well if you want to track your email click through rate.

"What we think, we become"

Contact me!

Have questions? Feel free to use the form or send me an email with any questions.

I will be responsive to your requests and your questions.