Back to API List
Analytics & Metrics API
Track events, generate reports, and provide dashboard data with real-time metrics.
Analytics
Internal API - Hosted by this App
API Endpoints & Usage
Explore and interact with the available endpoints for the Analytics & Metrics API. These API routes are live! The paths shown below are relative to your application's base URL. For example, if this application is hosted at
https://gen-endpoint.com
, an endpoint path for this API, such as /api/analytics/track
, would be accessible at https://gen-endpoint.com/api/analytics/track
. You can use the "Try it out" section for each endpoint or use tools like curl
, Postman, or your browser's address bar (for GET requests) to interact with them.POST
/api/analytics/track
Track user events and custom metrics.
Show Static Examples
Example Request Body:
{
"event": "page_view",
"userId": "usr_123",
"properties": {
"page": "/products",
"referrer": "google.com",
"device": "mobile"
},
"timestamp": "2024-08-16T12:00:00Z"
}
Example Response:
{
"success": true,
"eventId": "evt_789",
"processed": true
}
Try it out
GET
/api/analytics/track
Get recent tracked events for debugging.
Show Static Examples
Example Request Parameters:
?userId=usr_123&event=page_view&limit=10
Example Response:
{
"events": [
{
"id": "evt_789",
"event": "page_view",
"userId": "usr_123",
"timestamp": "2024-08-16T12:00:00Z",
"properties": {
"page": "/products"
}
}
],
"total": 50,
"filtered": 10
}
Try it out
You can add or change query parameters in the path above (e.g., ?name=User).
GET
/api/analytics/dashboard
Get dashboard metrics and KPIs for specified time range.
Show Static Examples
Example Request Parameters:
?period=7d&metrics=pageviews,users,conversions
Example Response:
{
"period": "7d",
"metrics": {
"pageviews": {
"value": 15420,
"change": "+12.5%"
},
"uniqueUsers": {
"value": 3254,
"change": "+8.2%"
},
"conversions": {
"value": 89,
"change": "-2.1%"
}
},
"topPages": [
"/products",
"/home",
"/about"
]
}
Try it out
You can add or change query parameters in the path above (e.g., ?name=User).