First and foremost, please forgive me if this is in the wrong section. I always seem to pick the wrong site when it comes to computer questions.

In the air of recent, wildly viral internet events, my buddy and I have formulated an idea to run an experiment to see how the phenomenon works. However, I am unsure of how the back-end would work.

We would host a single image file (.jpg/.png/.gif) on our server. The image is not intended to be hosted on a single web page - it is assumed this image will be cross posted, shared, etc. The fact that the image file itself is hosted on our server will remain constant (we're not taking into account situations where the image is saved/archived and hosted elsewhere, and then viewed).

We would like to be able to view a log of hits that the image gets, along with the IPs of viewing PCs (to figure out the progressive geographical spread of the image).

First, is this possible? I have seen many images that say 'your IP is blah blah blah, using Safari...', and I have also seen many instances where an image will "know" when its being hosted on a site other than its home (to prevent hotlinking).

Second, how would this be accomplished? Can an analytics program track such specific hits on a simple image file?


Just configure a web server, put the image onto it and configure the logging to what you want to log. I guess that Apache's default log configuration should be sufficient.

You can that feed that log into any analysis program you want.

  • Not sure why this is downvoted. This the most efficient way of doing this, because it doesn't rely on any preprocessors or have any dependancies – Mark Henderson Mar 22 '12 at 0:40

You've asked a few questions, so I'll separate the answers

  1. Log monitoring
  2. Dynamic images

Log monitoring

You can simply watch the access.log (assuming Apache) to see an overview of source IP and hits to the file you want. But this isn't going to give you any useful/tangible information - certainly since you are asking what analytics packages could be used to achieve this.

There are a few free applications available to do what you want, albeit with more complexity (and functionality than you probably require). They work at the server level by parsing the access logs. Two good examples are:

  1. Webalizer
  2. Awstats

Dynamic Images

If you want an image to contain dynamically generated information, like source IP, number of hits, date/time ... the list is endless; you'll need to use a programming language of sorts.

Depending on what platform you are using for your web server, different options are available to you. For example with PHP, you can use the Image GD library

Then you could not only serve dynamic images, but also track hits via MySQL to produce whatever output you like.

Contrary to the opinion of others, this is actually the most straightforward way to track and generate a dynamically generated image. The Server Fault flair badges are a good example of this.

You could then combine your data from this with the PECL GeoIP extension and plot your geographical map as you so desire.

  • 1
    Why so complicated? Any web server can log any access to a given file, you don't need a special program for that. – Sven Mar 22 '12 at 0:35
  • Observing the access logs is obvious, I didn't say you need a special program to do it. But the OP specifically said Can an analytics program track such specific hits - he didn't ask if he could manually read an access log file. – Ben Lessani - Sonassi Mar 22 '12 at 0:39
  • The question was if it's possible to log this stuff. Yes, it is, and it is easy, nothing special required. How he might analyse and visualize the data is another question. – Sven Mar 22 '12 at 0:42
  • @SvenW - its not another question, it is the question Can an analytics program track such specific hits to figure out the progressive geographical spread of the image An access log is a given with any webserver, but turning that information into something digestable is best achieved by programmatic means. Either by writing a custom bit of PHP to perform the tracking/serving or using a log analyser. Your answer of "checking the access log" isn't an answer, or helpful. – Ben Lessani - Sonassi Mar 22 '12 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.