bitcain docs
API Reference

Analytics

Platform analytics and performance tracking

Track Event

POST
/api/v1/analytics

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Request Body

application/json

event_name*string

Event name

Length1 <= length <= 100
category?string

Event category

Default"user_action"
Value in"page_view" | "user_action" | "trading" | "auth" | "error" | "performance" | "feature" | "system"
priority?string

Event priority

Default"medium"
Value in"low" | "medium" | "high" | "critical"
properties?

Event properties

timestamp?|

Event timestamp (defaults to server time)

session_id?|

Session identifier

page_url?|

Page URL where event occurred

referrer?|

Referrer URL

user_agent?|

User agent string

Response Body

application/json

application/json

curl -X POST "https://loading/api/v1/analytics" \  -H "Content-Type: application/json" \  -d '{    "event_name": "string"  }'
{
  "success": true,
  "event_id": "string",
  "message": "string",
  "timestamp": "2019-08-24T14:15:22Z"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Track Batch

POST
/api/v1/analytics/batch

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Request Body

application/json

events*array<>

List of events (max 100)

Items1 <= items <= 100
client_id?|

Client identifier

Response Body

application/json

application/json

curl -X POST "https://loading/api/v1/analytics/batch" \  -H "Content-Type: application/json" \  -d '{    "events": [      {        "event_name": "string"      }    ]  }'
{
  "success": true,
  "events_received": 0,
  "events_queued": 0,
  "events_failed": 0,
  "message": "string",
  "timestamp": "2019-08-24T14:15:22Z"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Get Analytics Stats

GET
/api/v1/analytics/stats

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Response Body

application/json

curl -X GET "https://loading/api/v1/analytics/stats"
{
  "total_events": 0,
  "events_by_category": {
    "property1": 0,
    "property2": 0
  },
  "events_today": 0,
  "events_this_hour": 0,
  "buffer_status": {
    "buffer_size": 0,
    "max_buffer_size": 0,
    "flush_interval_seconds": 0,
    "last_flush": "2019-08-24T14:15:22Z",
    "events_pending": 0,
    "events_flushed_total": 0
  }
}

Analytics Health

GET
/api/v1/analytics/health

Response Body

application/json

curl -X GET "https://loading/api/v1/analytics/health"
{}