API Reference
Analytics API
REST API endpoints for tracking views, calls, and engagement metrics.
Analytics API
Track skill engagement with views, calls, favorites, and usage analytics.
Overview
The analytics system tracks:
- Views - When a skill page is viewed
- Calls - When a skill is executed
- Favorites - When users favorite a skill
- Revenue - Total earnings per skill
Track View
POST /analytics/view
Record a skill page view.
Request:
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
skillId | string | Yes | UUID of the skill |
Response:
Views are deduplicated by IP address within a time window.
Track Call
POST /analytics/call
Record a skill execution. Typically called by the x402 middleware after successful payment.
Request:
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
skillId | string | Yes | UUID of the skill |
amount | string | No | Payment amount in USDC |
Response:
Track Usage
POST /analytics/usage
Record detailed usage for consumer balance tracking.
Request:
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
skillId | string | Yes | UUID of the skill |
amount | number | Yes | Amount in micro-dollars |
Response:
Toggle Favorite
POST /analytics/favorite
Toggle favorite status for a skill.
Request:
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
skillId | string | Yes | UUID of the skill |
action | string | Yes | add or remove |
Response:
Get Skill Analytics
GET /analytics/:skillId
Get analytics for a specific skill.
Request:
Response:
Analytics in Skill Responses
When fetching skill details, analytics are included:
Dashboard Analytics
Creators can view aggregate analytics for all their skills in the web dashboard:
- Total calls across all skills
- Total revenue earned
- Most popular skills by views/calls
- Recent activity timeline
Notes
- View tracking uses IP-based deduplication
- Call tracking is triggered by successful x402 payments
- Favorite counts are updated in real-time
- Revenue is calculated from successful skill usage records