const res = await fetch("https://api.openrevenue.com/api/v1/projects/example.com/countries?period=30d", {
headers: { Authorization: `Bearer ${OPENREVENUE_API_KEY}` },
})
const countries = await res.json()
curl "https://api.openrevenue.com/api/v1/projects/example.com/countries?period=30d" \
-H "Authorization: Bearer openrevenue_your_key"
{
"period": "30d",
"data": [
{ "country": "Morocco", "country_code": "MA", "pageviews": 114, "visitors": 27 },
{ "country": "United States", "country_code": "US", "pageviews": 8, "visitors": 3 },
{ "country": "United Kingdom", "country_code": "GB", "pageviews": 4, "visitors": 2 }
]
}
Countries
Returns visitor breakdown by country, ranked by pageviews. Includes ISO country codes.
GET
/
api
/
v1
/
projects
/
{domain}
/
countries
const res = await fetch("https://api.openrevenue.com/api/v1/projects/example.com/countries?period=30d", {
headers: { Authorization: `Bearer ${OPENREVENUE_API_KEY}` },
})
const countries = await res.json()
curl "https://api.openrevenue.com/api/v1/projects/example.com/countries?period=30d" \
-H "Authorization: Bearer openrevenue_your_key"
{
"period": "30d",
"data": [
{ "country": "Morocco", "country_code": "MA", "pageviews": 114, "visitors": 27 },
{ "country": "United States", "country_code": "US", "pageviews": 8, "visitors": 3 },
{ "country": "United Kingdom", "country_code": "GB", "pageviews": 4, "visitors": 2 }
]
}
Time period. See Periods on Account API page. Defaults to 30d.
Response
Errors
| Status | Error | Description |
|---|---|---|
401 | Invalid or missing API key | The Authorization header is missing or the Bearer token is invalid. |
404 | Project not found | No project with that domain exists for the authenticated user. |
const res = await fetch("https://api.openrevenue.com/api/v1/projects/example.com/countries?period=30d", {
headers: { Authorization: `Bearer ${OPENREVENUE_API_KEY}` },
})
const countries = await res.json()
curl "https://api.openrevenue.com/api/v1/projects/example.com/countries?period=30d" \
-H "Authorization: Bearer openrevenue_your_key"
{
"period": "30d",
"data": [
{ "country": "Morocco", "country_code": "MA", "pageviews": 114, "visitors": 27 },
{ "country": "United States", "country_code": "US", "pageviews": 8, "visitors": 3 },
{ "country": "United Kingdom", "country_code": "GB", "pageviews": 4, "visitors": 2 }
]
}
Was this page helpful?