Social analytics
Per-post, per-account, and per-campaign performance rollups with CSV export, plus scheduled email reports that render and send on a cadence.
Social analytics
Social analytics turns ingested engagement into numbers you can act on and
share. It rolls up metrics three ways — per post, per account, and per campaign
tag — exports any view to CSV, and can email a rendered report on a schedule.
The surface is served under /v1/social/analytics
(api/routes/social_analytics.py) and reads the engagement data ingested from
each network's provider.
Live surface
Post, account, and campaign rollups, CSV export, and the scheduled-report
CRUD + worker pass are all real endpoints and are backed by
social_scheduled_reports and the engagement tables.
Rollups
| View | Endpoint | What it returns |
|---|---|---|
| Post | GET /v1/social/analytics/posts/{public_id} | Metrics for one post. |
| Account | GET /v1/social/analytics/accounts/{public_id} | Performance rollup for one connected account. |
| Campaign | GET /v1/social/analytics/campaigns/{tag} | Aggregated metrics across every post carrying a campaign tag. |
Campaign rollups let you tag related posts (a launch, a webinar push) and see their combined reach and engagement without stitching post-level numbers by hand.
CSV export
Any post or account view can be pulled as a spreadsheet:
curl -X GET "https://api.pact.place/v1/social/analytics/posts/$POST_ID/export" \
-H "Authorization: Bearer $PACT_API_KEY" -o post-metrics.csv
The column set is fixed server-side (CSV_FIELDS_POST in
core/social_analytics.py), so exports are stable enough to build downstream
spreadsheets and BI feeds against. Account exports use the parallel
.../accounts/{public_id}/export route.
Scheduled reports
Unlike scheduled posts, scheduled reports have a working worker pass. A
scheduled report (GET/POST /v1/social/analytics/scheduled-reports) captures a
label, a report_kind, a schedule, and a recipient list. The worker
(run_scheduled_reports in core/social_analytics.py) finds every enabled,
non-deleted report whose next_run_at is due, renders it to HTML, and sends it
via the transactional email path; a failed run reschedules itself with a retry
interval.
- Update —
PATCH /v1/social/analytics/scheduled-reports/{public_id}(label, recipients, enabled). - Delete —
DELETE .../{public_id}(soft delete). - Trigger now —
POST /v1/social/analytics/scheduled-reports/runruns a due-report pass on demand and returns the ids that ran.
Metrics depend on ingested engagement
Analytics reflects the engagement Pact has ingested for your posts (via webhook or the per-post poll endpoint). A network you haven't connected — or a post whose engagements haven't been polled — contributes nothing to the rollups.