Read

get_analytics

Returns 7-day engagement metrics (views, trend, clicks, intent, sparkline) for a published profile so the creator can evaluate performance and decide what to change.


Parameters

NameTypeRequiredDescription
outlineIdstringThe numeric Payload doc ID of the outline to query. Omit to read the authenticated creator's own outline.

Response

FieldTypeWhat it means
outlineIdstringThe resolved numeric ID of the outline whose stats were fetched.
slugstringThe public URL handle for the profile (e.g. 'molly'). Empty string if the profile is unpublished.
windowstringAlways '7d' — the fixed analytics window. A 90-day Pro window is a documented future extension.
statsobject | nullProfileStats object when PostHog data is available; null when the profile is unpublished, POSTHOG_PERSONAL_API_KEY is unset, the API is unreachable, or the response cannot be parsed.
stats.views7dnumberBot-filtered $pageview count for the profile's public URL in the last 7 days.
stats.viewsPrev7dnumberBot-filtered $pageview count for the prior 7-day window (days 8–14). Used as the trend denominator.
stats.trendPctnumber | nullInteger percent change in views vs the prior 7-day window. Null when viewsPrev7d is 0 (avoids division by zero on brand-new profiles).
stats.clicks7dnumberCount of card_button_clicked + social_icon_clicked events in the last 7 days — measures how often visitors act on CTAs.
stats.intent7dnumberCount of booking_intent + purchase_intent events in the last 7 days — measures high-signal conversion moments.
stats.sparklinenumber[]Array of 7 daily $pageview counts ordered oldest to newest (index 0 = 7 days ago, index 6 = yesterday/today). Use to render a trend line or detect traffic spikes.
notestringHuman-readable guidance present only when stats is null. Two possible values: 'Publish your profile to start collecting analytics.' (unpublished) or 'Analytics are warming up or not yet configured. Check back soon.' (PostHog unavailable).

Example

Request

json
{ "outlineId": "42" }

Response

json
{ "outlineId": "42", "slug": "sara", "window": "7d", "stats": { "views7d": 312, "viewsPrev7d": 204, "trendPct": 53, "clicks7d": 47, "intent7d": 8, "sparkline": [28, 31, 40, 55, 62, 48, 48] } }

When to use

Call at step 7 of the create→curate→optimize loop — after publishing — to evaluate whether the profile is getting traction and which sections are driving clicks or booking intent. Pair with log_curation_decision to record what the creator changed in response to the data.


Gotchas

Watch out

  • stats is null for unpublished profiles — check for slug === '' before interpreting null as an error.
  • trendPct is null (not 0) when viewsPrev7d is 0; guard against null before doing arithmetic or displaying a percentage.
  • This tool uses the uncached fetchProfileStats — data is live, not the 10-minute cached version the dashboard shows. Repeated calls within seconds are fine but each one hits PostHog.
  • outlineId is owner-scoped via resolveOutlineDoc; you cannot query another creator's analytics by passing their ID — it will return FORBIDDEN.