Click here to Skip to main content
6,594,932 members and growing! (15,227 online)
Email Password   helpLost your password?
Web Development » ASP.NET » General     Intermediate

Tracking Emails for Open/Read

By Mohammad Ali Azam

Tracking Emails for Open/Read
C# 1.0.NET 1.1, Win2K, WinXP, ASP.NET, VS.NET2003, CEO, Architect, Dev
Posted:9 Aug 2006
Views:34,038
Bookmarked:44 times
Unedited contribution
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
13 votes for this article.
Popularity: 4.23 Rating: 3.80 out of 5
1 vote, 7.7%
1
1 vote, 7.7%
2
3 votes, 23.1%
3
3 votes, 23.1%
4
5 votes, 38.5%
5

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

About the Author

Mohammad Ali Azam


Member
Mohammad Ali Azam has been working as a Software Architect in Azolve
Technologies (BD) Limited
, located in Dhaka, Bangladesh since 2004. He is
also a member of board of directors in the same company.

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 and Human Resource Management System. 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 satellites (or on DVD) with his
wife!


Occupation: Web Developer
Location: Bangladesh Bangladesh

Other popular ASP.NET articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 15 of 15 (Total in Forum: 15) (Refresh)FirstPrevNext
GeneralEmail Tracking on Forward and Spam Emails PinmemberMember 28126003:59 5 Aug '08  
QuestionTracking Email for open/read Pinmembersudhir_kr21:56 22 Jul '08  
AnswerRe: Tracking Email for open/read PinmemberMohammad Ali Azam21:28 5 Aug '08  
GeneralRe: Tracking Email for open/read Pinmembersudhir_kr22:13 24 Aug '08  
Questioncan u help me to use this for validating email address?? Pinmemberibtesam_bloch23:08 19 Feb '07  
AnswerRe: can u help me to use this for validating email address?? PinmemberMohammad Ali Azam4:23 27 Feb '07  
GeneralBetter if you use in this way [modified] PinmemberSameers (theAngrycodeR )3:51 19 Aug '06  
GeneralRe: Better if you use in this way PinmemberMohammad Ali Azam4:25 27 Feb '07  
GeneralRe: Better if you use in this way PinmemberRabindranathsenpati5:12 16 Mar '07  
GeneralRe: Better if you use in this way PinmemberSameers (theAngrycodeR )11:37 16 Mar '07  
GeneralSmart technique, but ... Pinmembermgungora2:40 16 Aug '06  
GeneralRe: Smart technique, but ... PinmemberMohammad Ali Azam22:16 16 Aug '06  
GeneralTracking email: nice but... PinmemberNgo Tran Anh0:53 16 Aug '06  
GeneralRe: Tracking email: nice but... PinmemberMohammad Ali Azam22:13 16 Aug '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 9 Aug 2006
Editor:
Copyright 2006 by Mohammad Ali Azam
Everything else Copyright © CodeProject, 1999-2009
Web20 | Advertise on the Code Project