Programmatic access to your analytics data. Build custom dashboards, embed stats in your app, or automate reporting.
All requests require an API key passed in the Authorization header.
Authorization: Bearer gl_live_xxxxxxxxxxxxxxxxNote: API access requires a Business plan.Create your API key
5,000 requests per hour. Rate limit info is included in response headers:
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
X-RateLimit-Reset: 1700829600/stats/{websiteId}Retrieve analytics data for a specific website.
websiteIdstring, requiredtimeRange"7d" | "30d" | "90d" (default: "7d")curl "https://www.glancelytics.com/api/v1/stats/clx123?timeRange=7d" \
-H "Authorization: Bearer gl_live_xxx"{
"success": true,
"data": {
"domain": "example.com",
"totalViews": 15420,
"uniqueToday": 142,
"currentlyOnline": 8,
"totalViewsChange": 12.5,
"uniqueVisitorsChange": 8.3,
"chartData": [
{ "date": "2024-11-17", "totalViews": 320, "uniqueVisitors": 180 }
],
"topPages": [
{ "path": "/", "views": 1240 }
],
"topReferrers": [
{ "referrer": "google.com", "views": 450 }
]
}
}Coming soon:
/websites/websites/websites/{id}All errors return a consistent JSON structure:
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or expired API key"
}
}401Invalid or missing API key403Not on Business plan404Website not found429Rate limit exceededconst response = await fetch(
'https://www.glancelytics.com/api/v1/stats/clx123?timeRange=7d',
{
headers: {
'Authorization': `Bearer ${process.env.GLANCELYTICS_API_KEY}`
}
}
);
const { data } = await response.json();
console.log(data.totalViews);import requests
response = requests.get(
'https://www.glancelytics.com/api/v1/stats/clx123',
params={'timeRange': '7d'},
headers={'Authorization': f'Bearer {api_key}'}
)
data = response.json()['data']
print(data['totalViews'])Get an API key
Go to Dashboard → API Keys
Find your website ID
It's in your dashboard URL (e.g., /dashboard/clx123...)
Make a request
curl "https://www.glancelytics.com/api/v1/stats/YOUR_WEBSITE_ID" \
-H "Authorization: Bearer YOUR_API_KEY"Need help? Contact support
On this page