clarity_get_insights
Microsoft Clarity read low risk
Part of the User Behaviour Agent.
What it does
Microsoft Clarity behavioural metrics for a registered client's project via the DOCUMENTED Data Export API: traffic (sessions, bot sessions, distinct users, pages per session), scroll depth, engagement time, dead clicks, rage clicks, excessive scrolling, quick-back clicks, script errors, error clicks and popular pages, broken down by up to three dimensions (default URL and Device; also Browser, Country/Region, OS, Source, Medium, Campaign, Channel). This is the automated replacement for reading the Clarity dashboard by hand in a CRO audit: which landing pages produce friction on which devices. Hard limits set by Microsoft: the last 1-3 days only (num_of_days), 10 requests per project per day, 1,000 rows, three dimensions — the result says how much quota the call spent. The token comes from the client profile stored in Scalix (registered once under Clients); nothing is pasted in chat. Returns {success, data:{client, project_id, window_days, dimensions, metrics:[{name, rows}]}, count, warnings}.
When to use it
Use in every CRO audit (see cro_collect_brief) as the first Clarity call — friction signals by landing page and device — and whenever the user asks what Clarity says about traffic, scroll depth, dead or rage clicks. For natural-language questions use clarity_query_dashboard; for individual sessions use clarity_list_recordings.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
client | string | yes | The client's label (e.g. 'Acme Roofing') or Clarity project id exactly as registered under Clients in the Scalix console. The stored, encrypted token is used — never pass a token in chat. |
num_of_days | integer | no | 1, 2 or 3 — the last N days (UTC). Default 3. The export API cannot look further back. |
dimensions | array<string> | no | Up to 3 of: URL, Device, Browser, Country/Region, OS, Source, Medium, Campaign, Channel (case-insensitive; a comma-separated string also works). Default ['URL','Device']. |
Safeguards
Policy
Read-only. Clarity data is aggregate behavioural evidence for THIS client only: never re-identify a visitor, never pool clients, and cite the window (UTC, 1-3 days) with every figure. Each call spends one of the project's 10 daily requests — do not repeat a call whose result is already in the conversation. The token is never shown, logged or asked for.
Reminder
Percentages in the export are shares of sessions; a high dead-click rate on one URL and one device is a finding to confirm with clarity_list_recordings or the heatmap, not a conclusion.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
connection_not_found | No client with that label or Clarity project id is registered for your account. | Register the client under Clients in the Scalix console (label, Clarity project id, Data Export API token), then retry with the label. | no |
not_configured | The client exists but has no Clarity project id or API token stored. | Edit the client under Clients: add the Clarity project id and a token generated in Clarity -> Settings -> Data Export (project admins only). | no |
needs_reauth | Clarity rejected the stored token (expired, revoked or not authorised for this project); the client is now flagged. | Generate a new token in Clarity -> Settings -> Data Export and replace it under Clients; the flag clears on save. | no |
rate_limited | This Clarity project's 10 Data Export requests for today are used up. | Reuse the Clarity data already fetched today (it is in this conversation); the quota resets at 00:00 UTC. | no |
invalid_argument | An argument is outside what Clarity accepts. | Fix the argument named in the message and retry. | no |
platform_unavailable | Clarity did not answer or returned a server error. | Retry in a minute; if an undocumented endpoint answered 404, use clarity_get_insights instead and tell the Scalix team. | yes |
Edge cases
- The window is the last 1-3 days only; a quiet weekend can look like a drop — say so.
- Bot sessions are reported separately (totalBotSessionCount); use human sessions for rates.
- Rows are capped at 1,000 with no pagination; add a URL dimension filter by choosing fewer dimensions if a project is very large.
- An empty information array for a metric means no sessions had that signal in the window, not a failure.