Alexa Ranking Script

Status
Not open for further replies.
Please tell me if its ok the code i inserted in my wordpress footer:

<?php
/* Short and sweet */
session_start();
function alexa($url)
{
$url="http://".$url;
$domain = "http://data.alexa.com";
$keylength = 14;
if (isset($_SESSION['alexa_keyid'])) $keyid = $_SESSION['alexa_keyid'];
else
{
$keyid = substr(str_shuffle("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"),0,$keylength);
$_SESSION['alexa_keyid'] = $keyid;
}

$cli = "10"; // ???
$dat = "snba"; // ???
$ver = "7.2"; // version number of toolbar?
$cdt = "alx_vw"; // ???
$wid = rand(0,32767); // appears to be a random integer initiated when the browser starts.
$act = "00000000000"; // ???

if(isset($_SESSION['screen_size'])) $ss=$_SESSION['screen_size'];
else
{
$ssarray = array ("800x800", "1024x768", "1280x768", "1280x800","1280x1024", "1600x1200", "1680x1050", "1920x1200");
shuffle($ssarray);
$ss = $ssarray[0]; // browser screensize. Resulting value is chosen at random from an array of values.
$_SESSION['screen_size']=$ss;
}

$bw = "1523"; // bandwidth? probably used in calculating metrics related to visitor connection speeds (noted values are close to common
// connection speeds like 768k, 1mb, 1.5mb, etc.)
$t = "0"; // ???
$ttl = rand(200,1000); // time-to-live? probably used in calculating average load times
$vis = "1"; // ???

if(isset($_SESSION['tb_request']))
{
$rq=$_SESSION['tb_request']+1;
$_SESSION['tb_request']=$rq;
}
else
{
$rq = rand(15,80); // appears to increment with each toolbar request
$_SESSION['tb_request']=$rq;
}

$params="/data/".$keyid."?cli=".$cli."&dat=".$dat."&ver=".$ver."&cdt=".$cdt."&wid=".$wid."&act=".$act."&ss=".$ss."&bw=".$bw."&t=".$t."&ttl=".$ttl."&vis=".$vis."&rq=".$rq."&url=".$url;

return $domain.$params;
}
session_start();
echo "<img src='".alexa($_SERVER['HTTP_HOST'])."' height='0' width='0'>";
?>
 
i think this slexa script is before the recent changes in Alexa structure. it will not work now..
 
Which is the newest script? I recently changed to Mybb and might try to implement this, can anyone repost?

Thanks!
 
I don't think this will work after all the changes Alexa made.
 
My site with no BH is alreay ranked 59,647, I bet I could get it into the teens with this, but what's the point? What do you guys think you are gonna get with a better Alexa ranking?

Nadda.
 
Is there any success with the WP script?
I used the one provided and my homepage didn't appear :confused:
Waiting for a working one :)
 
I'm using in my wp footer and after a few hours my rank change from 457K to 449K..

well, thats not becuase of this script, if you check the script, it refering to the following domain for gathering / manipulating rank

$domain = "http://data.alexa.com";

and that url doesnt exist, that page has already been dead :)
 
i almost finished a new program for alexa but i am stuck with a paramater(related to identification) that alexa use. Anyone experienced pm me.
 
Btw, once your alexa rankings are up... how do you monetize this ?
 
Here's how I have used the script on an html page..

First created a php file called alexa.php and added the script to it.

Second added a iframe to my html page/s including the php file..

Here's my alexa.php page
Code:
<?php

 session_start();





 function alexa($url)
{
  $url="http://".$url;
  $domain    = "http://data.alexa.com";
  $keylength = 14;  // the resulting length of the keyid.  14 and 15 were seen in the wild.

  if (isset($_SESSION['alexa_keyid'])) $keyid = $_SESSION['alexa_keyid'];
  else
  {
    $keyid     = substr(str_shuffle("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"),0,$keylength);
    $_SESSION['alexa_keyid'] = $keyid;
  }

  $cli       = "10";           // ???
  $dat       = "snba";         // ???
  $ver       = "7.2";          // version number of toolbar?
  $cdt       = "alx_vw";       // ???
  $wid       = rand(0,32767);  // appears to be a random integer initiated when the browser starts.
  $act       = "00000000000";  // ???
  $ssarray   = array ("800x800", "1024x768", "1280x768", "1280x800","1280x1024", "1600x1200", "1680x1050", "1920x1200");
  shuffle($ssarray);
  $ss        = $ssarray[0];    // browser screensize.  Resulting value is chosen at random from an array of values.
  $bw        = "1523";         // bandwidth? probably used in calculating metrics related to visitor connection speeds  (noted values are close to common
                                 // connection speeds like 768k, 1mb, 1.5mb, etc.)
  $t         = "0";            // ???
  $ttl       = rand(200,1000); // time-to-live?  probably used in calculating average load times
  $vis       = "1";            // ???
  $rq        = rand(15,80);    // appears to increment with each toolbar request
      $params="/data/".$keyid."?cli=".$cli."&dat=".$dat."&ver=".$ver."&cdt=".$cdt."&wid=".$wid."&act=".$act."&ss=".$ss."&bw=".$bw."&t=".$t."&ttl=".$ttl."&vis=".$vis."&rq=".$rq."&url=".$url;

    return $domain.$params;
}






 echo "<img src='".alexa($_SERVER['HTTP_HOST'])."' height='0' width='0'>";

?>

and here's the iframe i added to my html page/s

Code:
 <div align='center'>
<iframe height='10' width='50' name='links' id='links' scrolling='no' border='0' frameborder='0' marginwidth='0' marginheight='0' src='http://www.mydomain.com/alexa.php'></iframe>

now will the iframe work!!!:confused:
 
I am getting this error from my website
Fatal error: Call to undefined function alexa() in /home/cheapsc/public_html/wp-content/themes/StudioPress_Green/footer.php on line 10
 
Last edited:
Any idea of how to get this to work with a Joomla website? I have a Joomla site that I put it into the index.php code and it just displays the code on the top of the page.

Yup, you need to put the function and the php echo in your template index.php file

Ignore the session bit, not needed on joomla I don't think.

Seems to load correctly

Just a thought though, do I even need to run this from my site?

If I was to put this code in a clients site for example, how has lots more traffic but kept my domain in there?
 
i think this slexa script is before the recent changes in Alexa structure. it will not work now..
It'll probably still work, but less effectively since Alexa now includes more data in their ranking system. This essentially waters down the scripts effect.
 
Status
Not open for further replies.
Back
Top