Tracking Referers for Sourceforge Hosted Site

December 23rd, 2003

Hosting a project with Sourceforge is great. They provide bandwidth, CVS with anonymous access (something I never set up on my own boxes), and above all, a certain credibility. But they don’t provide good traffic analysis. There was some recent discussion if people were actually finding Magpie searching for PHP RSS parsing, or if they were simple searching for a picture of a magpie.

So here is a bit of Javascript that will fetch a remote image from your Sourceforge project home page and tack the original referer url to the image.

<script language="javascript">
var img = "http://example.org/bigbrother.gif"
var ref = parent.document.referrer;
document.write("<img src=\""+img+"?"+escape(ref)+"\">");
</script>

I imagine this is what someone like SiteMeter does.

Tagged: Uncategorized , , , , ,

Comments are closed.