API analytics event tracking and funnels - capture custom events via Segment HTTP API, analyze conversion, and build retention views.
Agentic Workflow: Read -> Reason -> Act (api-analytics-event-tracking)
You are Api Analytics Event Tracking (sre) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — sre context for api-analytics-event-tracking
- Domain: API analytics event tracking and funnels - capture custom events via Segment HTTP API, analyze conversion, and build retention views.
- event-tracking: Track API events and analyze funnels —
curl -s -X POST https://api.segment.io/v1/track -u 'WRITE_KEY:' -H 'Content-Type
- Check
knowledge and prerequisites: prometheus, grafana, elasticsearch
2. Reason — think for api-analytics-event-tracking
- For
event-tracking: Track API events and analyze funnels — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with api-analytics-event-tracking tools
- Tools:
Glob, Grep, Read, Bash (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
api-analytics-event-tracking:dde50a31
API Analytics (Event Tracking)
What this skill does
Track custom product events around your API - signups, orders, feature use - via the Segment HTTP API, then analyze funnels and retention to understand conversion.
When to use
- Measuring feature adoption
- Building conversion funnels
- Cohort retention analysis
Real commands
# Track an event
curl -s -X POST https://api.segment.io/v1/track \
-u 'WRITE_KEY:' -H 'Content-Type: application/json' \
-d '{"userId":"u_123","event":"API Call","properties":{"endpoint":"/v1/orders"}}'
# Identify a user
curl -s -X POST https://api.segment.io/v1/identify \
-u 'WRITE_KEY:' -H 'Content-Type: application/json' \
-d '{"userId":"u_123","traits":{"plan":"enterprise"}}'
# Funnel analysis
curl -s 'http://localhost:8080/api/analytics/funnel?steps=visit,create_order,pay' | jq '.steps[].conversion'
# Retention
curl -s 'http://localhost:8080/api/analytics/retention?cohort=day' | jq '.cohorts[-1]'
# Event volume by name
curl -s http://localhost:8080/api/analytics/events -H 'X-API-Key: key' | jq '.events | group_by(.name) | map({name: .[0].name, count: length})'
Event schema discipline
{
"userId": "u_123",
"event": "Checkout Started",
"properties": { "endpoint": "/v1/orders", "status": 201 }
}
Best practices
- Use verb-past-tense event names (Order Completed)
- Keep a properties dictionary per event
- Send events from server-side, not the browser, for APIs
- Batch events and retry with backoff
Testing
curl -s -X POST http://localhost:8080/api/analytics/test-event -H 'Content-Type: application/json' -d '{"name":"Test"}'
curl -s 'http://localhost:8080/api/analytics/events?event=Test' | jq '.total'
Capabilities
event-tracking
Track API events and analyze funnels
Parameters:
event (string): Event name, e.g. API Call
steps (string): Comma-separated funnel steps
cohort (string): Cohort granularity: day, week, month
Commands:
curl -s -X POST https://api.segment.io/v1/track -u 'WRITE_KEY:' -H 'Content-Type: application/json' -d '{"userId":"u_123","event":"API Call","properties":{"endpoint":"/v1/orders"}}'
curl -s -X POST https://api.segment.io/v1/identify -u 'WRITE_KEY:' -H 'Content-Type: application/json' -d '{"userId":"u_123","traits":{"plan":"enterprise"}}'
curl -s 'http://localhost:8080/api/analytics/funnel?steps=visit,create_order,pay' | jq '.steps[].conversion'
curl -s 'http://localhost:8080/api/analytics/retention?cohort=day' | jq '.cohorts[-1]'
curl -s http://localhost:8080/api/analytics/events -H 'X-API-Key: key' | jq '.events | group_by(.name) | map({name: .[0].name, count: length})'
Examples:
References
1---2name: "api-analytics-event-tracking"3description: "API analytics event tracking and funnels - capture custom events via Segment HTTP API, analyze conversion, and build retention views. Use when working with event tracking or when the user mentions event tracking."4license: "MIT"5compatibility: "Requires prometheus, grafana, elasticsearch, node.js, python. Needs network access."6metadata:7 source: https://skillmd.com/skills/opknock/api-analytics-event-tracking8 author: Kdesk9 version: 2.0.010 category: sre11allowed-tools: "Glob Grep Read Bash(curl:*)"12---1314API analytics event tracking and funnels - capture custom events via Segment HTTP API, analyze conversion, and build retention views.1516## Agentic Workflow: Read -> Reason -> Act (api-analytics-event-tracking)1718You are **Api Analytics Event Tracking** (sre) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — sre context for `api-analytics-event-tracking`21- Domain: API analytics event tracking and funnels - capture custom events via Segment HTTP API, analyze conversion, and build retention views.22- **event-tracking**: Track API events and analyze funnels — `curl -s -X POST https://api.segment.io/v1/track -u 'WRITE_KEY:' -H 'Content-Type`23- Check `knowledge` and `prerequisites: prometheus, grafana, elasticsearch`2425### 2. Reason — think for `api-analytics-event-tracking`26- For `event-tracking`: Track API events and analyze funnels — decide which checks to run27- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs2829### 3. Act — execute with `api-analytics-event-tracking` tools30- Tools: `Glob`, `Grep`, `Read`, `Bash` (see frontmatter `tools`/`allowed-tools`)31- Use `safe_path` for any write; record evidence (paths, checksums)32- Fingerprint: `api-analytics-event-tracking:dde50a31`3334# API Analytics (Event Tracking)3536## What this skill does37Track custom product events around your API - signups, orders, feature use - via the Segment HTTP API, then analyze funnels and retention to understand conversion.3839## When to use40- Measuring feature adoption41- Building conversion funnels42- Cohort retention analysis4344## Real commands45```bash46# Track an event47curl -s -X POST https://api.segment.io/v1/track \48 -u 'WRITE_KEY:' -H 'Content-Type: application/json' \49 -d '{"userId":"u_123","event":"API Call","properties":{"endpoint":"/v1/orders"}}'5051# Identify a user52curl -s -X POST https://api.segment.io/v1/identify \53 -u 'WRITE_KEY:' -H 'Content-Type: application/json' \54 -d '{"userId":"u_123","traits":{"plan":"enterprise"}}'5556# Funnel analysis57curl -s 'http://localhost:8080/api/analytics/funnel?steps=visit,create_order,pay' | jq '.steps[].conversion'5859# Retention60curl -s 'http://localhost:8080/api/analytics/retention?cohort=day' | jq '.cohorts[-1]'6162# Event volume by name63curl -s http://localhost:8080/api/analytics/events -H 'X-API-Key: key' | jq '.events | group_by(.name) | map({name: .[0].name, count: length})'64```6566## Event schema discipline67```json68{69 "userId": "u_123",70 "event": "Checkout Started",71 "properties": { "endpoint": "/v1/orders", "status": 201 }72}73```7475## Best practices76- Use verb-past-tense event names (Order Completed)77- Keep a properties dictionary per event78- Send events from server-side, not the browser, for APIs79- Batch events and retry with backoff8081## Testing82```bash83curl -s -X POST http://localhost:8080/api/analytics/test-event -H 'Content-Type: application/json' -d '{"name":"Test"}'84curl -s 'http://localhost:8080/api/analytics/events?event=Test' | jq '.total'85```8687## Capabilities8889### event-tracking90Track API events and analyze funnels9192**Parameters:**93- `event` (string): Event name, e.g. API Call94- `steps` (string): Comma-separated funnel steps95- `cohort` (string): Cohort granularity: day, week, month9697**Commands:**98- `curl -s -X POST https://api.segment.io/v1/track -u 'WRITE_KEY:' -H 'Content-Type: application/json' -d '{"userId":"u_123","event":"API Call","properties":{"endpoint":"/v1/orders"}}'`99- `curl -s -X POST https://api.segment.io/v1/identify -u 'WRITE_KEY:' -H 'Content-Type: application/json' -d '{"userId":"u_123","traits":{"plan":"enterprise"}}'`100- `curl -s 'http://localhost:8080/api/analytics/funnel?steps=visit,create_order,pay' | jq '.steps[].conversion'`101- `curl -s 'http://localhost:8080/api/analytics/retention?cohort=day' | jq '.cohorts[-1]'`102- `curl -s http://localhost:8080/api/analytics/events -H 'X-API-Key: key' | jq '.events | group_by(.name) | map({name: .[0].name, count: length})'`103104**Examples:**105- curl -s -X POST https://api.segment.io/v1/track -u 'WRITE_KEY:' -d '{"userId":"u_123","event":"Checkout Started","properties":{"cart":{"total":99.9}}}'106- curl -s 'http://localhost:8080/api/analytics/funnel?steps=signup,activate,invite' | jq '.steps'107- curl -s 'http://localhost:8080/api/analytics/events?event=API%20Call&from=2024-06-01' | jq '.total'108109## References110- [Segment HTTP Tracking API](https://segment.com/docs/connections/sources/catalog/libraries/server/http/)111- [Amplitude HTTP API](https://developers.amplitude.com/docs/http-api-v2)