Click here to Skip to main content
Click here to Skip to main content
Go to top

Tracking Emails for Open/Read

, 9 Aug 2006
Rate this:
Please Sign up or sign in to vote.
Tracking Emails for Open/Read

Introduction

Most of the email users get a number of opt-in emails each day. Many of you might have noticed that a marketing campaign starts and sends out a number of emails. At the beginning, you might have interested reading such advertising. And eventually you stopped reading them. But the marketing company would not stop sending you emails and you also didn't opt-out yourself from the mailing list! Although after a certain period of time, you might have noticed that the company stopped sending you further emails.

Question is that, did they stop their campaign? Answer is 'possibly no'. So why they stopped sending you email. Did they know that you are not reading their emails? Answer is 'probably yes!' 'Yes?' - but how they could know that you are no longer interested in reading their email offers?

Background

It's all about a technique called 'email tracking'. By email tracking, a marketing company can track whether you read a particular post. That is, after sending emails to you, they can track out whether you've read those emails at all. Even surprisingly, they can also track the location and date/time when (and from where) you've read those emails!

Is it really possible at all? Yes technically it's very easy to track emails whether they are read or not!

Before we go into too depth, we must understand that only email containing HTML as part of its MIME type can be used to be tracked. As you know, in an HTML email we can easily put a graphics in it. Graphics can be very nice image, or it can simply be an invisible image (a transparent image with 1x1 size for example).

When we put an image into an HTML source we write similar to the following:

<img src="some-source-onto-your-server.gif"/>

But when it's required to track an e-mail's status, the src property of the <img> element looks a bit trickier. Consider the following:

<img src="ImageServer.aspx?imageID=track.jpg& custID=134ghxx34343ai& campID=32434"/>

Using the code

As you can guess easily that the image source url itself (the src property of the <img> tag) does not point to an image type file, instead it's a query string to be executed within an .aspx file (may be also .jsp, .php etc.). That's all behind the scene. The code inside the ImageServer.aspx.cs is as simple as following:

private void Page_Load(object sender, System.EventArgs e)
{
    // content type should be resolved programmatically
    Response.ContentType = "image/jpeg";
    if (!IsPostBack) Track();
    Response.WriteFile(GetImageFileByID());
}

When the browser sends a GET method using the above query string, the .aspx file parses the query, determines who the user opens the email up to read, then the program stores a flag in the database table to indicate that a particular email for a particular campaign has been opened by the customer. Additionally the program can also store other information; such as date/time information, remote IP to determine location information etc.

In my code, I have used an index.aspx file as if it were an email previously sent to a customer to mimic the fact when such email tracking occures in real life.

Test vs Real Life Project

Please bear in mind that in a real life and fit-to-production-environment email campaign solution, this implementation can't give the ultimate performance. Usually for such big real life project, one need to implement fully fledged tracking server, which acts like a web server (almost like the IIS itself).

Final Thoughts

Upon only one reason the above program may fail to track to determine whether a particular email has been opened or not - if the email client (such as Yahoo or MSN) disables the graphics to be downloaded for email containing HTML content. In Yahoo Mail, user can set their preference not to download graphics for their emails. In this case <img> tags are tweaked by the Yahoo Server, and hence no graphics would be downloaded from other servers. So as no image to download, no tracking to occur at the marketing agent's end!!!


That's all about email tracking!!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Mohammad Ali Azam
Architect TechAnts Technologies Limited
Bangladesh Bangladesh

Mohammad Ali Azam has been working as an Architect in TechAnts Technologies Limited, located in Dhaka, Bangladesh since 2008.

Azam had long been working as a Senior Java Enterprise Architect in several companies and now has been working on software development using ASP.NET platform. He is as competent in both Visual C# and Visual Basic .NET as he is in J2EE.

For last couple of years, he has actively been working on Email Campaign Software, ECMS, Search Engine Integration, Hospital Management System, Knowledge Management System, Human Resource Management System and open source PHP web application such as Joomla, WordPress and Magento. Along with his regular tasks in the industry, he has also been researching on inventing technologies to promote Rapid Application Development (RAD).

While he works on designing various component models utilizing the best industry practices and the latest specification of UML, at leisure, he plays with his little baby girl and watches Sci-Fi movies on satellite TVs (or on DVDs) with his
wife!


You may also be interested in...

Comments and Discussions

 
GeneralRe: Tracking Email for open/read Pinmembersudhir_kr24-Aug-08 21:13 
Questioncan u help me to use this for validating email address?? Pinmemberibtesam_bloch19-Feb-07 22:08 
AnswerRe: can u help me to use this for validating email address?? PinmemberMohammad Ali Azam27-Feb-07 3:23 
GeneralBetter if you use in this way [modified] PinmemberSameers (theAngrycodeR )19-Aug-06 2:51 
Well, better to use in this way
 
<img src="http://yourserver/134ghxx34343ai-32434.jpeg">
 
instead of using .aspx page. You can create a handler in your application to handle jpeg types (know what I mean?)
 
who knows it is a tracking image or normal picture?
 
BTW in 134ghxx34343ai-32434.jpg, 134ghxx34343ai is your client id and 32434 is the campaign id.
 
-- modified at 8:55 Saturday 19th August, 2006
 
Need custom software? Contact DevelopersINN[^]
Never miss an appointment! Try Outlook Personal Assistant[^]

GeneralRe: Better if you use in this way PinmemberMohammad Ali Azam27-Feb-07 3:25 
GeneralRe: Better if you use in this way PinmemberRabindranathsenpati16-Mar-07 4:12 
GeneralRe: Better if you use in this way PinmemberSameers (theAngrycodeR )16-Mar-07 10:37 
GeneralSmart technique, but ... Pinmembermgungora16-Aug-06 1:40 
GeneralRe: Smart technique, but ... PinmemberMohammad Ali Azam16-Aug-06 21:16 
GeneralTracking email: nice but... PinmemberNgo Tran Anh15-Aug-06 23:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 9 Aug 2006
Article Copyright 2006 by Mohammad Ali Azam
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid