1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how can I track out how many visitors....

Discussion in 'Black Hat SEO Tools' started by trafficsource, Jul 10, 2009.

  1. trafficsource

    trafficsource Jr. VIP Jr. VIP Premium Member

    Joined:
    May 22, 2009
    Messages:
    793
    Likes Received:
    1,130
    Occupation:
    IM
    Location:
    Baltic States
    how can I track out how many visitors are on my website at the moment?
    thank you.
     
  2. vegasvillan

    vegasvillan Regular Member

    Joined:
    Jan 15, 2009
    Messages:
    406
    Likes Received:
    511
    Location:
    NYC
    google analytics
     
  3. trafficsource

    trafficsource Jr. VIP Jr. VIP Premium Member

    Joined:
    May 22, 2009
    Messages:
    793
    Likes Received:
    1,130
    Occupation:
    IM
    Location:
    Baltic States
    uhhhhh but where is button in there Analytics which shows how many people on my website at the moment?
     
  4. risefromdeath

    risefromdeath Power Member

    Joined:
    Jul 1, 2009
    Messages:
    650
    Likes Received:
    107
    i dont think anlaytics will help...
     
  5. 4alllifestyles

    4alllifestyles Junior Member

    Joined:
    Dec 3, 2008
    Messages:
    170
    Likes Received:
    98
    GAnalytics isn't realtime....

    Piwick does this.. Quite probable that there is a plugin for whatever CMS your using as well...
     
  6. vegasvillan

    vegasvillan Regular Member

    Joined:
    Jan 15, 2009
    Messages:
    406
    Likes Received:
    511
    Location:
    NYC
    I quick read your post...I have selective reading lol my bad
     
  7. trafficsource

    trafficsource Jr. VIP Jr. VIP Premium Member

    Joined:
    May 22, 2009
    Messages:
    793
    Likes Received:
    1,130
    Occupation:
    IM
    Location:
    Baltic States
    Piwick shows visitors real time? where I can get this piwick?
     
  8. revit

    revit BANNED BANNED

    Joined:
    Apr 24, 2009
    Messages:
    266
    Likes Received:
    370
    This is a simple script to display in your page the number of visitors you have online. It uses a .txt file to write and store the visitors for a time period before updating itself. It uses nothing more than that .txt file so there''s no need for coding knowledge, mysql databases whatsoever. Just use the following line in your scripts and CHMOD your visitors.txt file to 777 so we can read and write it. The script (assuming that we've named the tct file "visitors.txt"):

    HTML:
    
    <?php
    $dataFile = "visitors.txt";
    
    $sessionTime = 30; //this is the time in **minutes** to consider someone online before removing them from our file
    
    //Please do not edit bellow this line
    
    error_reporting(E_ERROR | E_PARSE);
    
    if(!file_exists($dataFile)) {
    	$fp = fopen($dataFile, "w+");
    	fclose($fp);
    }
    
    $ip = $_SERVER['REMOTE_ADDR'];
    $users = array();
    $onusers = array();
    
    //getting
    $fp = fopen($dataFile, "r");
    flock($fp, LOCK_SH);
    while(!feof($fp)) {
    	$users[] = rtrim(fgets($fp, 32));
    }
    flock($fp, LOCK_UN);
    fclose($fp);
    
    
    //cleaning
    $x = 0;
    $alreadyIn = FALSE;
    foreach($users as $key => $data) {
    	list( , $lastvisit) = explode("|", $data);
    	if(time() - $lastvisit >= $sessionTime * 60) {
    		$users[$x] = "";
    	} else {
    		if(strpos($data, $ip) !== FALSE) {
    			$alreadyIn = TRUE;
    			$users[$x] = "$ip|" . time(); //updating
    		}
    	}
    	$x++;
    }
    
    if($alreadyIn == FALSE) {
    	$users[] = "$ip|" . time();
    }
    
    //writing
    $fp = fopen($dataFile, "w+");
    flock($fp, LOCK_EX);
    $i = 0;
    foreach($users as $single) {
    	if($single != "") {
    		fwrite($fp, $single . "\r\n");
    		$i++;
    	}
    }
    flock($fp, LOCK_UN);
    fclose($fp);
    
    if($uo_keepquiet != TRUE) {
    	echo '<div style="padding:5px; margin:auto; background-color:#fff"><b>' . $i . ' visitors online</b></div>';
    }
    
    ?>
    
    

    Usage:
    HTML:
    
    <?php
    include('index.php'); 
    //here we call the script                                     
    //you can change the name of                                     
    //your folder to whatever you                                      
    //like but don't forget to change                                      
    //it name here also.
    ?>
    
    

    You can also add the following to disallow bots to show up as visitors:

    HTML:
    
    stripos($_SERVER['HTTP_USER_AGENT'], 'bot') === false should do the job. So the whole part would be: if($alreadyIn == FALSE AND stripos($_SERVER['HTTP_USER_AGENT'], 'bot') === false) { $users[] = "$ip|" . time(); }