Newsletter Email Tracking: Read or Not?

Posted by Subesh Pokhrel 26 October, 2008

I have completed first phase of a simple, yet useful Newsletter System. When I demonstrated to the clients, they came up with a question if the newsletter being send was opened or not by the newsletter subscribers ? I then thought.. let see how its done. Then I came with this simple tracking trick, most of the spammers used to verify if the email address was valid or not.
The first thing I did was adding 1px by 1px image on the footer of the newsletter, whose source was set something like this http://subesh.com.np/newsletter/track.php?identitycode=CLIENTID_SENDEMAILID. Here CLIENTID = Your Clients ID and SENDEMAILID = Id of the Newsletter sent. Now, when the image is loaded while viewing the newsletter on the mail or say when the client reads the newsletter email. The track.php page is requested with identitycode as the GET parameter. And when you get the request from the mail to your server’s page, you can do anything you want. What I did was setting the mail_read column of the database field as 1. And echoed the source of the image file on the last line.
The code below is for the track.php.


<?php
$get=explode("_",$_GET['identitycode']);
$sendid=$get['0'];
$recid=$get['1'];
$query="INSERT INTO tbl_track SET mail_read='1' WHERE send_id='$sendid' and user_id='$recid'";
mysql_query($query);
echo "http://subesh.com.np/newsletter/images/transparent_1px.gif";
?>

Isn’t this the easiest idea anyone could ever come up with. Yeha! Thumbs up to me!!

Categories : PHP Tags : , ,

Comments
November 13, 2008

You can do the same with ASP?

Posted by sachi
November 14, 2008

Yeha! Sure…

Posted by Subesh Pokhrel
December 3, 2008

nice trick but never ever forget to sanitize the data before using them in a query…

Posted by Roshan Bhattarai
December 4, 2008

yeha!… I have seen the function sanitize()…ummmm… yeha… joomla search component :D

Posted by Subesh Pokhrel
Leave a comment

(required)

(required)