Skip to main contentSkip to Content
Analytics

Analytics

CampaignOS provides comprehensive analytics across contacts, campaigns, messages, and events.

Overview Dashboard

GET /api/workspaces/{workspaceId}/analytics

Returns summary metrics for the last 30 days.

Auth: Session required

Response:

{ "contacts": { "total": 50000, "new": 1200 }, "campaigns": { "total": 25, "active": 8 }, "messages": { "total": 150000, "sent": 145000, "opened": 43500, "clicked": 14500, "openRate": 0.30, "clickRate": 0.10 }, "events": { "total": 500000 } }

Campaign Analytics

GET /api/workspaces/{workspaceId}/analytics/campaigns/{campaignId}

Detailed performance analytics for a specific campaign.

Query Parameters:

ParamTypeDefaultDescription
periodstring30dTime period (e.g., 7d, 30d, 90d)

Response:

{ "campaign": { "id": "cmp_1", "name": "Welcome Series" }, "enrollments": { "total": 5000, "active": 1200, "completed": 3800 }, "messages": { "total": 12000, "sent": 11500, "delivered": 11200, "opened": 3360, "clicked": 1120, "bounced": 200, "failed": 100, "openRate": 0.30, "clickRate": 0.10, "bounceRate": 0.018 }, "statusBreakdown": [ { "status": "DELIVERED", "_count": 11200 }, { "status": "OPENED", "_count": 3360 } ], "channelBreakdown": [ { "channel": "EMAIL", "_count": 10000 }, { "channel": "PUSH", "_count": 2000 } ], "abTests": [ { "id": "ab_1", "name": "Subject Line Test", "variants": [ { "name": "Variant A", "sent": 500, "opened": 150 }, { "name": "Variant B", "sent": 500, "opened": 200 } ] } ] }

Time Series

GET /api/workspaces/{workspaceId}/analytics/timeseries

Daily time series data for key metrics.

Query Parameters:

ParamTypeDefaultDescription
daysnumber30Number of days

Response:

{ "period": "30d", "series": [ { "date": "2026-01-15", "events": 1500, "contacts": 40, "messages": 500, "opens": 150, "clicks": 50 } ] }

Email activity

GET /api/workspaces/{workspaceId}/analytics/activity

What the dashboard’s Email activity charts show: when emails get opened, how many are sent per day and how many contacts are new per day. Hours and days are in the workspace time zone.

Query Parameters:

ParamTypeDefaultDescription
daysnumber30Window, 1–90 days

Response:

{ "timezone": "Europe/Malta", "days": 30, "opensByHour": [0, 0, 1, 3, 12, 40, 95, 180, 230, 260, 210, 150, 120, 110, 130, 140, 120, 90, 70, 60, 40, 20, 8, 2], "opensByWeekday": [410, 390, 420, 400, 350, 120, 90], "peakHour": 9, "totals": { "sent": 6200, "opened": 2180, "newContacts": 410 }, "daily": [ { "date": "2026-10-05", "sent": 220, "opened": 80, "newContacts": 14 } ] }

opensByHour has 24 entries (0–23), opensByWeekday seven starting on Monday, and daily one row per local day, oldest first. peakHour is null when nothing was opened. Only email messages count; anonymous contacts are left out of newContacts.

Attribution

GET /api/workspaces/{workspaceId}/analytics/attribution

UTM-based traffic attribution data.

Query Parameters:

ParamTypeDefaultDescription
daysnumber30Lookback period

Response:

{ "period": "30d", "sources": [ { "source": "google", "medium": "cpc", "campaign": "summer-sale", "uniqueVisitors": 500, "totalEvents": 1200 } ], "totalAttributedEvents": 5000, "conversions": 150 }

Funnel Analysis

GET /api/workspaces/{workspaceId}/analytics/funnel

Track conversion through a sequence of event types.

Query Parameters:

ParamTypeDefaultDescription
stepsstringrequiredComma-separated event types
daysnumber30Lookback period

Example: /analytics/funnel?steps=page_view,signup,purchase&days=30

Response:

{ "period": "30d", "steps": [ { "step": "page_view", "count": 10000, "dropoff": 0, "conversionFromPrevious": 1.0 }, { "step": "signup", "count": 1000, "dropoff": 9000, "conversionFromPrevious": 0.10 }, { "step": "purchase", "count": 200, "dropoff": 800, "conversionFromPrevious": 0.20 } ], "overallConversion": 0.02 }

Cohort Retention

GET /api/workspaces/{workspaceId}/analytics/cohorts

Cohort-based retention analysis grouped by signup date.

Query Parameters:

ParamTypeDefaultDescription
daysnumber30Lookback period
metricstringeventsRetention metric

Response:

{ "period": "30d", "metric": "events", "cohorts": [ { "cohort": "2026-01-01", "size": 100, "activeContacts": 60, "retentionRate": 0.60, "retention": { "week_0": 100, "week_1": 80, "week_2": 65, "week_3": 60 } } ] }
Last updated on