views:

40

answers:

2

i'd like to have google analytics also spider images (eg. livecams) - i mean it should directly spider how much a certain .jpg was loaded.

is this possible?

+1  A: 

Google Analytics works by loading some JavaScript that then loads basically a fake GIF file.

http://code.google.com/apis/analytics/docs/concepts/gaConceptsOverview.html

When all this information is collected, it is sent to the Analytics servers in the form of a long list of parameters attached to a single-pixel GIF image request.

So, basically what you are asking for isn't possible.

What you can do however is wrap your JPG in a file that can include that JS. You could even create a page that has a .JPG file extension but is actually a webpage (via PHP or .Net)

In that page you can log your 'hit' to google and then stream out the image file.

http://www.devshed.com/c/a/PHP/Creating-Image-Streams-from-Existing-Graphics-with-the-GD-Library-in-PHP/2/

However, seems like your best bet here is to just look at your own weblogs?

Justin Jenkins
A: 

This is a little advanced, but you could send tracking beacons (gif hits) from your server side code, then return the livecam image dynamically either via a redirect or by writing directly to the response. In PHP you'd use something like cURL to send the gif hit request to Google's servers:

http://us3.php.net/manual/en/curl.examples-basic.php

You'll have to play with the gif hit URL a bit to get the right stats, but I would start with this:

http://www.google-analytics.com/__utm.gif?utmac=UA-XXXXX-X&utmhn=mydomain.com&utmp=%2Fmylivecam.jpg

You'll need to replace UA-XXXXX-X with your GA account and you'll need to replace mydomain.com and mylivecam.jpg with the appropriate values.

Brian