1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Looking For The Code For Visitor Counter

Discussion in 'HTML & Website Design' started by richardm55, Feb 16, 2013.

  1. #1
    How does your page visitors counter work? Can it be made just using Javascript code or it must use php code too?
    Any suggestions are welcome.
    Thank you in advance.
     
    richardm55, Feb 16, 2013 IP
  2. Original Hosting

    Original Hosting Active Member

    Messages:
    203
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    50
    #2
    You can use tools like Google Analytics which will give you a code to embed into your page and track visitors.
     
    Original Hosting, Feb 16, 2013 IP
  3. richardm55

    richardm55 Active Member

    Messages:
    762
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    65
    #3
    And that code give me the number of visitors coming to my website each day or other period of time?
     
    richardm55, Feb 16, 2013 IP
  4. Original Hosting

    Original Hosting Active Member

    Messages:
    203
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    50
    #4
    It will show you the number of visitors over whatever time period you choose. It will also show where your visitors were referred from and their approximate location.
     
    Original Hosting, Feb 16, 2013 IP
  5. richardm55

    richardm55 Active Member

    Messages:
    762
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    65
    #5
    Thank you very much for your lovely help. But I did not mean that, mate. I wanted to show the number of visitors on my website, not at Google Analitics
     
    Last edited: Feb 16, 2013
    richardm55, Feb 16, 2013 IP
  6. Calanau

    Calanau Active Member

    Messages:
    143
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    78
    #6
    You can use other online software that provide a counters that will allow you to show on your website how many visitors your website had over a specific period of time.

    One that I know of is Histats.com

    You can choose the counter to be displayed on your site for everyone to see. If that's what you need.
     
    Calanau, Feb 16, 2013 IP
  7. Hostname.club

    Hostname.club Active Member

    Messages:
    165
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    90
    Digital Goods:
    11
    #7
    Yeah, I totally agree. Histats.com has very good dashboard to track all online users on your site. :) I'm using it for about 40 our sites.
     
    Hostname.club, Feb 16, 2013 IP
  8. richardm55

    richardm55 Active Member

    Messages:
    762
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    65
    #8
    Thank you guy for very good help.
     
    richardm55, Feb 17, 2013 IP
  9. kenzo22

    kenzo22 Member

    Messages:
    177
    Likes Received:
    11
    Best Answers:
    2
    Trophy Points:
    43
    #9
    You can use Histats or just google for visitor counter, you will surely find a huge number of completed code which you can use on your website.
     
    kenzo22, Feb 17, 2013 IP
  10. richardm55

    richardm55 Active Member

    Messages:
    762
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    65
    #10
    I could not register into Histats website due to stupid security code I can not guess despite I try all combinations. What annoying is that.
     
    richardm55, Feb 17, 2013 IP
  11. Original Hosting

    Original Hosting Active Member

    Messages:
    203
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    50
    #11
    refresh the page and get another one!
     
    Original Hosting, Feb 17, 2013 IP
  12. richardm55

    richardm55 Active Member

    Messages:
    762
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    65
    #12
    I have finally registered there and I have implemented the visitors counters into my websites.
     
    richardm55, Feb 17, 2013 IP
  13. Alam

    Alam Active Member

    Messages:
    316
    Likes Received:
    91
    Best Answers:
    0
    Trophy Points:
    68
    #13
    <?php
     
     
    $user_ip        =    getenv("REMOTE_ADDR");    // user ip
    $timestamp        =    time();
    $url            =    htmlentities($_SERVER['PHP_SELF']);    //file path
     
     
     
    $timeoutseconds =    2400;    // Timeout Value in Seconds
    $timeout        =    $timestamp-$timeoutseconds;
     
     
     
     
    if(isset($sess_user_id)){$user_id=$sess_user_id;}else{$user_id=0;}
     
     
     
    mysql_query("INSERT INTO `shop_visitors` (`user_id` ,`user_ip` ,`timestamp` ,`url`) VALUES ('$user_id', '$user_ip', '$timestamp' , '$url') ") or die(".");
    mysql_query("DELETE FROM `shop_visitors` WHERE timestamp<$timeout") or die("<br />Records deleting...");
     
     
    //Getiing online vistiors
     
     
    $results    =    mysql_query("SELECT DISTINCT user_ip FROM shop_visitors") or die("Getting records");
     
    $online      =    mysql_num_rows($results);
     
    if ($online>=0){echo " Now ".$online." visitors online";}
     
     
     
     
     
    ?>
    
    Code (markup):
    I am using this php scripts to count and display live online visitors. you can avoid user_id field in your database table.

    You can also visit one of my site to show this scripts live result http://www.tabletbd.com/ (last line in footer)
     
    Alam, Feb 17, 2013 IP
  14. richardm55

    richardm55 Active Member

    Messages:
    762
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    65
    #14
    Thank you, mate, but I wanted visitor counter written in Javascript because weebly does not let me to insert php code there. I knew visitors counter in php was easy to find.
     
    richardm55, Feb 17, 2013 IP
  15. ryan_uk

    ryan_uk Illustrious Member

    Messages:
    3,983
    Likes Received:
    1,022
    Best Answers:
    33
    Trophy Points:
    465
    #15

    The problem with JavaScript is it needs to call home somewhere to make a record of how many visitors (or use an image - that used to be very popular). These days, there aren't the same selection of services. Anyway, you got into HiStats! You can always make a "fake" JavaScript one (generates a random number).
     
    ryan_uk, Feb 17, 2013 IP
  16. richardm55

    richardm55 Active Member

    Messages:
    762
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    65
    #16
    Thank you mate. Well, I have expected that php must be used to realize the visitor counter. But I will use that one from HiStats. I don't need the fake one. I want to know real results.
     
    richardm55, Feb 17, 2013 IP
  17. Brandon Scott

    Brandon Scott Greenhorn

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #17
    There's tons online mate
     
    Brandon Scott, Feb 17, 2013 IP
  18. richardm55

    richardm55 Active Member

    Messages:
    762
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    65
    #18
    You mean similar service like HiStats offers? I am sure other companies offer such a service because it is good way for them to get high traffic to them. But I am not looking for any of them but reliable one and I heard that HiStats is pretty good. Maybe you could recommend something particular?
     
    richardm55, Feb 18, 2013 IP
  19. creativewebmaster

    creativewebmaster Active Member

    Messages:
    654
    Likes Received:
    7
    Best Answers:
    4
    Trophy Points:
    78
    #19
    Dear Richard,

    This will help you http://www.hitwebcounter.com

    Thanks,
     
    creativewebmaster, Feb 19, 2013 IP
  20. Stone Rain

    Stone Rain Greenhorn

    Messages:
    15
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    11
    #20
    http://statcounter.com has a nice, easily embeddable script, plus it can email weekly reports of traffic.
     
    Stone Rain, Feb 19, 2013 IP