开发者

Google Analytics: Spider Image

开发者 https://www.devze.com 2022-12-23 06:59 出处:网络
i\'d like to have google analytics also spider images (eg. livecams) - i mean it should directly s开发者_如何学JAVApider how much a certain .jpg was loaded.

i'd like to have google analytics also spider images (eg. livecams) - i mean it should directly s开发者_如何学JAVApider how much a certain .jpg was loaded.

is this possible?


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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消