Read any report for a website: visitors, pages, sources, locations, technology and events.
Send the key as a Bearer token in the Authorization header.
Requests without a valid key return 401 Unauthorized.
Plans without API access return 403 Forbidden.
name to choose the report.curl --location --request GET 'https://www.dashboard.datablik.com/api/v1/stats/{website_id}?name={name}&from={from}&to={to}' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {api_key}'
const response = await fetch('https://www.dashboard.datablik.com/api/v1/stats/{website_id}?name={name}&from={from}&to={to}', {
method: 'GET',
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer {api_key}'
}
});
const data = await response.json();
<?php
$curl = curl_init('https://www.dashboard.datablik.com/api/v1/stats/{website_id}?name={name}&from={from}&to={to}');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Authorization: Bearer {api_key}',
],
]);
$data = json_decode(curl_exec($curl), true);
curl_close($curl);
| Name | Type | Description | Default |
|---|---|---|---|
nameRequired |
string |
The report to return. One of browser campaign city continent country device event language operating_system page pageview referrer screen_resolution visitor
|
— |
fromRequired |
string |
Start date in Y-m-d format.
|
— |
toRequired |
string |
End date in Y-m-d format.
|
— |
search |
string |
Search query. | — |
search_by |
string |
Field to search. value Value.
|
— |
sort_by |
string |
Sort by. count Count, value Value.
Default: count |
count |
sort |
string |
Sort direction. desc Descending, asc Ascending.
Default: desc |
desc |
per_page |
integer |
Results per page. 10 25 50 100
Default: 10 |
10 |