See our new project: DomainStats.io

API Documentarion for Redistats

We have a simple API that uses GET parameters and gives a simple JSON response. With this you can display your own numbers and graphs without using our iframe.

Limit: 10 requests per second per IP.

The GET request

https://redistats.com/api?gid=xxx&pid=xxx&start_date=xxx&end_date=xxx&data_type=xxx&code=xxx

The GET parameters

gid is the global ID number.

pid is the property ID number. Write 0 for global stats of all properties with this global ID.

start_date and end_date is represented by 8 numbers, yyyymmdd. In PHP this is date('Ymd'). Both dates are included in the counting. To get data for a single day then make both values the same day. The start_date cannot be older than 3 months from today. If the end_date is in the future it will be considered to be todays date. We use UTC 0.

data_type see below.

code is an md5 hash and has to be md5($gid.$pid.$start_date.$end_date.$data_type.$your_secret_api_key). If you have the wrong code more than 3 times your IP will be blocked for 1 hour.

The data_type parameter

total_visits

Returns a single number with the sum of total visits in the selected time period.
Example: {"total_visits":10433}

total_pageviews

Returns a single number with the sum of total pageviews in the selected time period.
Example: {"total_pageviews":15484}

visits

Returns an array with the days and the count of visits.
Example: {"20130820":"5579","20130821":"5578","20130822":"4894"}

pageviews

Returns an array with the days and the count of pageviews.
Example: {"20130820":"7896","20130821":"7912","20130822":"6532"}

pages

Returns an array with the top 60 pages sorted by highest first. Values are the sum of visits in the date range.
Example: {"http:\/\/fullmovies.cc":8629,"http:\/\/fullmovies.cc\/category-Action":1003,"http:\/\/fullmovies.cc\/category-Comedy":642 ...

referrers

Returns an array with the top 60 referrers sorted by highest first. Values are the sum of visits in the date range.
Example: {"Google Organic":7876,"Direct":5665,"http:\/\/www.example.com\/":561,"Bing Organic":154,"http:\/\/www.url.com\/":107 ...

terms

Returns an array with the top 60 terms sorted by highest first. Values are the sum of visits in the date range. In the case of same terms but different search engines they are added together.
Example: {"[not provided]":1200,"full movies":491,"youtube movies":473,"full movie":142 ...

browsers

Returns an array with the top browser types sorted by highest first. Values are the sum of visits in the date range.
Example: {"Mobile":1469,"Chrome":1148,"Tablet":743,"Firefox":594,"Internet Explorer":400,"Safari":176,"Opera":155,"Console":64,"Unknown":6}

countries

Returns an array with the top 60 countries sorted by highest first. First the country code and then the country name seperated with comma. Values are the sum of visits in the date range.
Example: {"us,United States":1098,"ph,Philippines":503,"in,India":462,"my,Malaysia":288,"ca,Canada":253,"gb,United Kingdom":240,"id,Indonesia":187,"sg,Singapore":152 ...

Code examples

Get count of visitors the last 14 days using PHP

$global_id = 34;
$property_id = 53435;
$start_date = date('Ymd', strtotime('-14 days'));  
$end_date = date('Ymd');
$api_key = '3434a35fgfg654633f3sfsdfbd9f5gfhfgh645a040893fb0dcab8bc12030105cc5e';
$api_code = md5($global_id.$property_id.$start_date.$end_date."total_visits".$api_key);
$json = file_get_contents("https://redistats.com/api?gid=".$global_id."&pid=".$property_id."&start_date=".$start_date."&end_date=".$end_date."&data_type=total_visits&code=".$api_code);
$api_obj = json_decode($json);
$count_total_uniques = $api_obj->{'total_visits'};