by Greg71
8 replies
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.
#link #tracking
  • Profile picture of the author dad2four
    Are you wanting to do this through a script a third party service or do you want to code it into your site?
    Signature
    {{ DiscussionBoard.errors[7650383].message }}
    • Profile picture of the author Greg71
      Originally Posted by dad2four View Post

      Are you wanting to do this through a script a third party service or do you want to code it into your site?
      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.
      {{ DiscussionBoard.errors[7651433].message }}
  • Profile picture of the author Dan Grossman
    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.
    Signature
    Improvely: Built to track, test and optimize your marketing.

    {{ DiscussionBoard.errors[7650587].message }}
    • Profile picture of the author Greg71
      Originally Posted by Dan Grossman View Post

      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.
      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
      {{ DiscussionBoard.errors[7651439].message }}
      • Profile picture of the author Damien Roche
        Just use google analytics. You can setup custom tracking if you want to drill into only those links. Statcounter is another option.
        Signature
        >> Seasoned Web Developer (CSS, JavaScript, PHP, Ruby) <<
        Available for Fixed Fee Projects and Hourly ($40/hr)
        {{ DiscussionBoard.errors[7651852].message }}
        • Profile picture of the author dad2four
          Google Analytics is definitely a great idea. If you aren't using it you'll have alot of fun with everyhing that Analytics tracks and how it presents it.

          It's very easy to install on your site. Just sign up for analytics and you'll be given a piece of javascript to add to your pages that you want tracked.

          There are many that don't trust google having that much of a view into what's going on with your site. For example if you are using Google Adsense there are many sources of traffic that are unacceptable according to the terms of service. If you allow Google to view where your traffic comes from through Analytics many believe you may be getting traffic from unacceptable sources, and be telling on yourself. Even accidentally traffic can come from sources that Google doesn't allow.

          Withough going the database route you can use a link tracker like Linktrack.info - The Best Link Tracker and Ad Tracker Ever

          That's not an affiliate link. I believe that's a pay service, don't quote me, but there are free link tracking services out there as well.

          If you decide to code it into your site ask questions and we can help you get it done.

          Have fun.
          Signature
          {{ DiscussionBoard.errors[7651863].message }}
        • Profile picture of the author Greg71
          Originally Posted by Damien Roche View Post

          Just use google analytics. You can setup custom tracking if you want to drill into only those links. Statcounter is another option.
          Yeah, I have Analytics set up on it. I didn't know you could do "custom" tracking. I will check that out most definitely. Thanks.
          {{ DiscussionBoard.errors[7653902].message }}
      • Profile picture of the author Dan Grossman
        Originally Posted by Greg71 View Post

        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
        It's worth learning, especially since you want to be in the business of selling wordpress websites.

        Recommended reading:

        Home - PHP & MySQL: Novice to Ninja, 5th Edition
        Signature
        Improvely: Built to track, test and optimize your marketing.

        {{ DiscussionBoard.errors[7652131].message }}

Trending Topics