Link Tracking

by 8 replies
10
Hi.

I have a site that links out to 4 sites in the same industry. My site is a "directory" with the 4 companies on it.

Is there a way to track people clicking on the 4 links, so I know how much traffic I'm sending each company?

Thanks.
#programming #link #tracking
  • Are you wanting to do this through a script a third party service or do you want to code it into your site?
    • [1] reply
    • Yeah, I just want to code it into the site. I thought there might be an easy peasy way, like a link attribute (a href etc) that would track it somehow, but looks like the inevitable database stage is upon me. Guess I'll have to learn some stuff.
  • Make a database table with three columns: id, url, num_clicks

    Enter a row into the database for each of your four links, having 4 different IDs, their URLs, and 0 num_clicks.

    Link to
    Code:
    http://www.example.com/yourscript.php?link=#
    yourscript.php connects to the database, runs one SELECT query to retrieve the row with the ID from the query string, runs one UPDATE query to increment the num_clicks column of that row, then redirects the visitor to the URL you looked up by sending a location header.
    • [ 1 ] Thanks
    • [1] reply
    • I know what you mean, but I will have to hit the textbooks again. I'm not quite at your level, but not too far off what you're talking about.

      Thanks for the reply,
      Greg
      • [2] replies

Next Topics on Trending Feed

  • 10

    Hi. I have a site that links out to 4 sites in the same industry. My site is a "directory" with the 4 companies on it.