29

How is it possible to get traffic data, sub domains data, country rank in percentage like in http://www.websiteoutlook.com/www.google.com?

VLAZ
  • 26,331
  • 9
  • 49
  • 67
Prakash
  • 2,749
  • 4
  • 33
  • 43

8 Answers8

98

NB: This approach doesn't work anymore. The endpoint simply returns "Ok", even for URLs which aren't assigned.

There is a free API (though I haven't been able to find any documentation for it anywhere).

http://data.alexa.com/data?cli=10&url=%YOUR_URL%

You can also query for more data the following way:

http://data.alexa.com/data?cli=10&dat=snbamz&url=%YOUR_URL%

All the letters in dat are the ones that determine which info you get. This dat string is the one I've been able to find which seems to have more options. Also, cli changes the output completely, this option makes it return an XML with quite a lot of information.

EDIT: This API is the one used by the Alexa toolbar.

Community
  • 1
  • 1
Lumbendil
  • 2,906
  • 1
  • 19
  • 24
  • Awesome... works well. Do you know if there's a way to get the per country rank though? Say I want to get my websites rank in Australia. – mlevit Nov 26 '11 at 04:07
  • There isn't a way, since the toolbar doesn't need that information (it doesn't show it). In case it's necessary, you should consider the paid API. – Lumbendil Nov 30 '11 at 12:00
  • I read that making lot of requests to this URL will give you "503" error.. – Ayush Goyal Jan 26 '13 at 16:43
  • I haven't verified it, but since they have a paid API, it's logical that they'd put some kind of throttling in this one, which isn't meant for general use, but for their toolbar. – Lumbendil Jan 27 '13 at 15:47
  • 3
    +1 for the incredible free link. – Masud Rahman Aug 21 '13 at 00:40
  • It seems not working now. – ZillGate Dec 26 '13 at 01:13
  • @ZillGate I just used it and had no issues. – Lumbendil Jan 02 '14 at 11:45
  • Anyone knows what's the limit to the number of requests? It seems like it basically only provides the dmoz.org info, which I'm sure could be had from elsewhere. – cnst Jan 27 '14 at 18:58
  • @cnst it provides a bit more information. The relevant additional info is on . As for the limit of requests, I don't currently know, since, as stated, it's a "private" API. – Lumbendil Jan 29 '14 at 12:06
  • 3
    It works great, thanks! I've just used this API the other day, and there appears to be no limits (as long as you don't stuff Alexa with as many requests per second as it could possibly handle -- a small delay between the requests is all that's needed to have all of them return `200 OK`). – cnst Jan 30 '14 at 05:53
  • 10
    This API not working for now and return Okay! – Hadi Akbarzadeh May 11 '18 at 22:47
  • @nabeghe i have the same response, is there a solution? – mma7 May 19 '18 at 21:47
  • 2
    Where are the "dat" letters documented? – Cerin Jan 16 '19 at 23:01
16

A simple function to get the alexa rank

function alexa_rank($url){
    $xml = simplexml_load_file("http://data.alexa.com/data?cli=10&url=".$url);
    if(isset($xml->SD)):
        return $xml->SD->REACH->attributes();
    endif;
}

Works pretty well and free ;)

Warface
  • 5,029
  • 9
  • 56
  • 82
  • 2
    Perfect thanks! I just added this to return the number with thousands separator: return number_format(floatval($xml->SD->REACH->attributes())); – Daniele B Nov 26 '14 at 15:41
14

you can use this too

<?php
$url="http://stackoverflow.com/";
$xml = simplexml_load_file('http://data.alexa.com/data?cli=10&dat=snbamz&url='.$url);
$rank=isset($xml->SD[1]->POPULARITY)?$xml->SD[1]->POPULARITY->attributes()->TEXT:0;
$web=(string)$xml->SD[0]->attributes()->HOST;
echo $web." has Alexa Rank ".$rank;
?>

this will output it like

stackoverflow.com has Alexa Rank 55
5

Alexa have an API here. It's not free, though.

Pekka
  • 442,112
  • 142
  • 972
  • 1,088
3

SimilarWeb has an API that exposes its traffic and ranking data. They also provide engagement metrics, referrals and domain categorization APIs, among others, so maybe it'll be good for you.

API - developer.similarweb.com

vsync
  • 118,978
  • 58
  • 307
  • 400
1

Usage for SimilarWeb Traffic API:

function api_traffic (URL, KEY) {

  var apiurl = "http://api.similarweb.com/Site/"
  + URL
  + "/v2/EstimatedTraffic?Format=JSON&UserKey=";
  + "KEY";


var fetch_visitors = UrlFetchApp.fetch(apiurl);
    Utilities.sleep(2000);

      var data = JSON.parse( fetch_visitors);
    return data.EstimatedVisitors;
    }
1

By using http://data.alexa.com/data?cli=10&url=%YOUR_URL% API you can have all data.

Mxx
  • 8,979
  • 4
  • 27
  • 37
0

http://www.siteprice.org/api/ is the cheapest I think and easy to use.

$worthofwebsite= file_get_contents('http://www.siteprice.org/WorthApi.aspx?type=1&key=testkey&url=google.com'); 
echo "Website Worth: ".$worthofwebsite;
Sam Salim
  • 2,145
  • 22
  • 18