views:

42

answers:

2

Lets say there's a landing page. I need to be able to count the number of referrals coming from 4 different URLs. So then I can come back later and see how many came from each.

Can someone show me how this can be done?

Can this be done with javascript using an array and the referrer property or would i have to use PHP

thanks so much in advance for the help!

A: 

Forget using any client side technology - that won't give you the ability to record the results in a central location (although you could use a client side technology in conjunction with a server side one, as Google Analytics does, but that would be complicated).

The simplest way would be to examine your log files, rather then start setting up another logging system altogether.

Something along the lines of:

grep "http://example.com/your/referer/here" /var/logs/apache/access.log | wc -l

… would probably do the trick.

Possibly with a bit more refinement should you want to check for specific dates.

David Dorward
+1  A: 

I use Google Analytics for tracking statistics and referrals. You insert a small piece of JavaScript into your page with a ID number provided by Google. It's free and very effective.

John Strickler