Page redirection and web counter??

Discussion in 'HTML & Website Design' started by kizeebo, Jun 2, 2008.

  1. #1
    Hi, I'm new the boards and a very novice web designer. I am looking to have one website redirect to another site but have the first site gather webstats (# of hits, what link ppl clicked on to get to that page, etc). Would a meta-refresh tag allow me to collect webstats such as Google Analytics? What would be the best way to go about collecting webstats and redirecting pages? Thank you guys for any help!
     
    kizeebo, Jun 2, 2008 IP
  2. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #2
    you can use something such as php to create and update stats in a database or in a file, then redirect to the new page
     
    crath, Jun 2, 2008 IP
  3. TechnoGeek

    TechnoGeek Peon

    Messages:
    258
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Would you mind telling us why you want to do a redirect in the first place? Redirects are not usually well regarded. You must have a very good reason for using a meta refresh redirect. Normal coding of web pages does not require using this device.
     
    TechnoGeek, Jun 2, 2008 IP
  4. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #4
    sounds like he is directing an old domain to a new one, but wants to see how many people are still going to the old one? just an idea :p

    this can actually be done with php referrer as well

    why not use google analytics? its great
     
    crath, Jun 2, 2008 IP
  5. kizeebo

    kizeebo Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I guess it would help to explain what I am trying to do...

    I'm trying to do internet marketing for companies. (I'm a marketer not a programmer so that's why I appreciate your help!)

    I am going to promote a company's website and I want to track how many hits I'm brining in. I'd like to be in control of viewing the webstats and not have the company add any code to its existing site. My idea was to have one of my sites just redirect to theirs and capture the stats. Not sure if this is the best way to do it though. Any suggestions from the pros out there??
     
    kizeebo, Jun 4, 2008 IP
  6. q7m

    q7m Well-Known Member

    Messages:
    1,178
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    150
    Digital Goods:
    1
    #6
    You need to have a database record for every website you are promoting. Then, instead of linking to www.clientwebsite.com, you link to www.yoursite.com/out.php?id=clientid. The "out.php" script does the following:
    - locate the record that has the id = "clientid";
    - increase the number of hits for this record;
    - redirect to the website stored in this record (www.clientwebsite.com).
     
    q7m, Jun 4, 2008 IP
  7. kizeebo

    kizeebo Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thank you so much!

    However, not being a programmer, I have no idea how to do any of that! Do you suggest I hire a programmer full-time or have a programmer set it up or should I just try to learn it myself since this will be an ongoing thing?
     
    kizeebo, Jun 5, 2008 IP
  8. q7m

    q7m Well-Known Member

    Messages:
    1,178
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    150
    Digital Goods:
    1
    #8
    I don't know what to say. This task requires some php/mysql skills. It's up to you to decide what's the best option for you.
     
    q7m, Jun 6, 2008 IP
  9. ferman

    ferman Well-Known Member

    Messages:
    968
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    140
    #9
    google analytic is best to track hits
     
    ferman, Jun 6, 2008 IP
  10. QiSoftware

    QiSoftware Well-Known Member

    Messages:
    805
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    158
    #10
    Have you thought about a Javascript onload redirect?

    Q...
     
    QiSoftware, Jun 6, 2008 IP
  11. whirlybird20

    whirlybird20 Guest

    Messages:
    462
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Your Google Analytics code should be something like this.

    <script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
    var pageTracker = _gat._getTracker("UA-1482761-5");
    pageTracker._initData();
    pageTracker._trackPageview();
    </script>
    Code (markup):
    So just add this at the bottom before the </script>

    document.location.href="http://yournewsite.com";
    Code (markup):
    The final result should look like this.

    <script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
    var pageTracker = _gat._getTracker("UA-1482761-5");
    pageTracker._initData();
    pageTracker._trackPageview();
    document.location.href="yournewsite.com";
    </script>
    Code (markup):
    This will run the google analytics script before redirecting, so should work.

    The problem is that some people do not have javascript enabled so for these few people, I would also include a text link that just says something like "Enter" in big letters.

    Hope this helps
     
    whirlybird20, Jun 6, 2008 IP
  12. popnyc

    popnyc Active Member

    Messages:
    1,391
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #12
    I'm also looking for a redirect. Would this script work for an affiliate link? ie I don't want to loose sales and leads.
    thanks for posting the script.
     
    popnyc, Aug 14, 2008 IP