Forum Moderators: coopster

Message Too Old, No Replies

PHP script query

         

jaycee33

9:08 am on Feb 7, 2005 (gmt 0)

10+ Year Member



Could someone tell me what PHP script I need to write to effect the following:

I need to log when one of my site visitors clicks on a link on one of my pages to go to one of the merchants I recommend, to enable me to see which pages are converting best etc. I currently use "statcounter.com" for my stats and need to include one of their javascripts in each of the pages visited to log visitor activity.

I had thought of using exit.php for the php script but in this there is no page (am I right?) in which to include the statcounter script.

I have a low technical knowledge so would appreciate some help.

StupidScript

12:40 am on Feb 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You probably do not need to include the page you are referring to in your stats, do you? It's not a visitor page, but rather an admin page. Otherwise:

You could set up an exit page through which all outbound links go, grab the link target from the incoming URL and then reset the browser location to that new address. Then when you look at your stats page, you would see how many times that exit page had been requested...?

If you want details, you may need to set up a little database to collect info from those hits, like where the outbound link was going to and stuff like that.

Sorry, but you're getting out of the novice stuff and into more customized, programmable solutions. How much of a newbie are you? Do you have your own server, or is this a $5 hosted solution? There are lots of factors which will expand or limit what you have available to you.

rlkanter

3:35 am on Feb 8, 2005 (gmt 0)

10+ Year Member



I'm not sure how you would see which links convert the best, maybe if the merchants you're dealing with give you the incoming link refers, or the timestamp.

If you simply want to record people clicking on outgoing links, the easiest way I can think of is to setup a db with all the links and at least a counter. Then have all the links in a format like link.php?link=#, and when that php script is called increment the counter and then send them to the corresponding page.