Invisible Counter on PDF File
July 31, 2005 8:47 PM   Subscribe

I have a pdf file on my official/department university web page. I would like to know how often the pdf is viewed, and as a super bonus, the domain names for who is viewing. How do I do this, without it being apparent that I am doing it?

I have no programming skills. I do not want the to consult the IT people in my department. I do not want the people viewing the pdf to know that there is a counter in place.

What I'm thinking is that if I embed a small picture in the pdf and host the picture at flickr or wherever then I can probably get a count of the number of people who have viewed the picture, right? Is this a plausible method and would anyone notice I was doing it? (i.e. would some people's browsers warn that an outside picture was being loaded? would there be one of those annoying "no picture" icons if the settings were configured to not load the picture?)

How else could I find out how many people were looking at my pdf? I have access to the unix folder in which all my web files are stored. I can edit the pdf as much as I want or put pretty much anything in my WWW folder. I do not have access to any sort of administrative folder.
posted by anonymous to Computers & Internet (6 answers total)
I don't think it's possible to do something like embed an externaly linked image in a PDF file. PDF files are intended to be totaly static, meaning they always look exactly the same, and totaly self contained. What they actualy contain isn't marked up text like a HTML page, or a word document, or whatever, but actual instructions that could be used by a printer, just like a computer program.

So, while you can look at who downloads the PDF origionaly, you can't monitor who looks at it by embeding an external image.

There may be some way to have the PDF 'phone home', maybe by using the DRM features.
posted by delmoi at 9:12 PM on July 31, 2005

You could perhaps setup a .htaccess file that redirects the pdf link to a script somewhere that logs the hit, and then sends them back to the pdf file.
posted by Jairus at 9:14 PM on July 31, 2005

write a short php script that redirects to the pdf download link and also runs a get on a link that you're tracing or updates a db variable.

Here's a script that appears to perform something like what you need.

php should work out of the gate on your server. Your IT guys will probably know you're tracking hits, if they care to look into it, but your visitors will mostly remain happily clueless.
posted by fishfucker at 9:23 PM on July 31, 2005

I'm about to launch a service in the next few days that will do exactly what you need. I don't want to link to it from here, but if you want the name, you can find my email in my profile.
posted by null terminated at 11:15 PM on July 31, 2005

If you have access to the server logs, you don't have to do anything. Just search the logs for accesses to that URL, and you'll have the date, time, and remote address of every person that downloaded your file.

If you don't have access to the logs, then you have two choices: Make some kind of wrapper that logs the hit in another way (as others have already said) or switch to a web hosting setup where you do have access to the logs. Just about any competent web host will have this, so it's not a hard requirement to fulfill and wouldn't necessarily cost much at all. I do suspect that most of the "free web hosting" sites will not provide you this access, but for a few dollars a month you should be able to find someone that does.

If you're not talking about hosting the file on a web server (for example if it's on a network share) then your task becomes significantly harder. I don't think it would be possible, unless you had admin access to the server that it was stored on in order to enable and view logging of network file traffic.
posted by Rhomboid at 12:03 AM on August 1, 2005

You can embed Javascript code into newer-format PDF documents. The code can be triggered whenever the document is opened. Such code can include a custom URL access that you can filter from your web logs, e.g. do an XML HTTP request of a "dummy" page that only your PDF would access. The filtered host data in your web log would refer to those hosts reading this PDF electronically.

This document explains how to make PDF documents expire. By making the PDF expire after a single access, as well as requiring an account to access the PDF file from a server, you can also track usage this way. However, it is more intrusive than an XML request and requires Adobe's policy server management tool, which will require an investment of funds.
posted by Rothko at 12:39 AM on August 1, 2005

« Older Where can I find an m&ms jingle from the 80s?   |   weird whiskers Newer »
This thread is closed to new comments.