When you send off an email containing a document such as an .odt or .doc file, wouldn’t it be nice if you could know exactly when that document is read? The trick is to place a webbug within the document, which will fire off an HTTP request to a server. And then you simply review your logs too see ip adress, date and time.

I remember reading about this technique a couple of years ago, and recently I wanted to see if this thing still worked. So, we want to place an image in the document, where the source of this image is to an HTTP resource. This is also known as a webbug, web beacon or a tracking pixel. This will fire off a request to a webserver I control.

Firstly, I made a short php script which simply logs ip and date whenever someone request it. bug.php:

<?php
 
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("F j, Y, g:i a");
 
$file = "web_bug_log.txt";
$fp = fopen($file, "a");
fwrite($fp, "$date $ip");
fclose($fp);
 
?>

Next we want to place the webbug inside a document. For my testing I used OpenOffice 3.2 on ubuntu. In the toolbar in OpenOffice click Insert -> Picture -> From file and choose a random picture you have saved on your computer. Click Open. Now you rightclick the image and click Picture, and paste in the url to your php script. Click OK. I could not find any way in OpenOffice to directly embed a picture with an HTTP link, but this workaround do not requre much work.

Now you resize the image to 1×1 pixel, and place it somewhere appropriately. Send off your document via email etc, and watch those logs.

This also worked on a couple of years old version of Microsoft Office. Works probably on the newest too.