Gen-Endpoint
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",
  "sessionId": "sess_abc", 
 "properties": {
    "page": "/products",
    "referrer": "google.com"
  },
  "timestamp": "2024-08-16T12:00:00Z"
}

Example Response:

{
  "success": true,
  "eventId": "evt_789",
  "processed": true,
  "timestamp": "2024-08-16T12:00:00Z"
}
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",
      "sessionId": "sess_abc",
      "timestamp": "2024-08-16T12:00:00Z",
      "properties": {
        "page": "/products",
        "userAgent": "Mozilla/5.0...",
        "ip": "127.0.0.1",
        "deviceType": "desktop"
      }
    }
  ],
  "totalInFilter": 1,
  "totalInStore": 50
}
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",
  "dateRange": {
    "start": "2024-08-09T...",
    "end": "2024-08-16T..."
  },
  "metrics": {
    "pageviews": {
      "value": 15420,
      "change": "+12.5%"
    },
    "uniqueUsers": {
      "value": 3254,
      "change": "+8.2%"
    },
    "conversions": {
      "value": 89,
      "change": "-2.1%"
    }
  },
  "topPages": [
    {
      "page": "/products",
      "views": 500
    },
    {
      "page": "/home",
      "views": 300
    }
  ],
  "deviceBreakdown": [
    {
      "device": "desktop",
      "count": 10000,
      "percentage": 65
    },
    {
      "device": "mobile",
      "count": 5420,
      "percentage": 35
    }
  ],
  "realTime": {
    "activeUsers": 123,
    "pageViewsLastHour": 1500,
    "eventsLastHour": 3200
  },
  "generatedAt": "2024-08-16T..."
}
Try it out

You can add or change query parameters in the path above (e.g., ?name=User).