Microsoft Clarity Data Export: Complete Guide to Getting Your Data Out
Microsoft Clarity collects rich behavioral data, but getting that data out of Clarity and into your own systems is not straightforward. This guide covers every export method available, with step-by-step instructions, code examples, and the trade-offs of each approach.
Why Export Clarity Data?
Clarity's built-in dashboard is useful for quick analysis, but it has real limitations for teams that need more:
- Custom reporting: Combine Clarity data with Google Analytics, CRM data, or revenue metrics in a single dashboard
- Data warehousing: Feed Clarity data into BigQuery, Snowflake, or Postgres for cross-tool analysis
- Historical analysis: Store data beyond Clarity's 30-day dashboard retention
- Automated alerts: Trigger Slack notifications when rage clicks spike or scroll depth drops
- AI analysis: Feed metrics to GPT-4 or Claude for automated insight generation
Method 1: Dashboard CSV Export
The simplest option -- and the most limited. Clarity's dashboard lets you export some data as CSV files directly from the browser.
How to Export
- Log in to clarity.ms and select your project
- Navigate to the Dashboard tab
- Set your date range (up to 30 days back)
- Click the download/export icon on individual widgets
What You Get
- Session counts, user counts, pages per session
- Top pages with basic engagement metrics
- Device and browser breakdowns
Limitations
- Manual process -- no automation possible
- Limited to what's visible on the dashboard
- No per-page frustration signals (dead clicks, rage clicks)
- Maximum 30 days of historical data
Warning: Dashboard CSV export does not include Clarity's most valuable data: rage clicks, dead clicks, quick-back events, and excessive scroll signals. For these metrics, you need the API.
Method 2: Clarity Data Export API
The API is the most powerful export method and the only way to programmatically access frustration signals. It was introduced as a REST endpoint for project-level insights.
Prerequisites
- A Clarity project with the tracking code installed
- An API token from Clarity Settings → Data Export
- Your project ID (visible in the URL:
clarity.ms/app/<PROJECT_ID>/dashboard)
API Endpoint
POST https://www.clarity.ms/export-data/api/v1/project-live-insights
Headers:
Authorization: Bearer <YOUR_API_TOKEN>
Content-Type: application/json
Body:
{
"projectId": "<YOUR_PROJECT_ID>",
"numOfDays": 1
}
Response Data
The API returns a JSON object with per-page metrics. Here's what each field contains:
| Field | Type | Description |
|---|---|---|
url |
string | Page URL |
totalSessionCount |
integer | Total sessions on this page |
distinctUserCount |
integer | Unique visitors |
pagesPerSession |
float | Average pages viewed per session |
scrollDepth |
float | Average scroll depth (0-100) |
activeTime |
float | Average active time in seconds |
deadClickCount |
integer | Clicks on non-interactive elements |
rageClickCount |
integer | Rapid repeated clicks (frustration) |
quickBackCount |
integer | Users who navigated away and immediately returned |
excessiveScrollCount |
integer | Users scrolling up and down repeatedly |
Python Example
import requests
import os
import json
def export_clarity_data(num_days=1):
url = "https://www.clarity.ms/export-data/api/v1/project-live-insights"
headers = {
"Authorization": f"Bearer {os.environ['CLARITY_API_TOKEN']}",
"Content-Type": "application/json"
}
payload = {
"projectId": os.environ["CLARITY_PROJECT_ID"],
"numOfDays": num_days
}
response = requests.post(url, json=payload, headers=headers)
response.raise_for_status()
data = response.json()
results = data.get("results", [])
print(f"Exported {len(results)} page records")
return results
# Save to JSON file
results = export_clarity_data()
with open("clarity_export.json", "w") as f:
json.dump(results, f, indent=2)
Rate Limits and Constraints
- 10 requests per day per project -- plan your queries carefully
- Maximum 3 days back --
numOfDaysaccepts 1, 2, or 3 - Maximum 1,000 rows per response -- no pagination available
- No date range selection -- you get the most recent N days only
Tip: Since you only get 10 API calls per day, the most efficient strategy is one call per day with numOfDays: 1. Store each day's results in a database to build your historical dataset. See our historical data guide for the full setup.
Method 3: Clarity MCP Server
Microsoft released an MCP (Model Context Protocol) Server for Clarity, which allows AI assistants and LLM-powered tools to query Clarity data conversationally.
What Is MCP?
MCP is an open protocol that lets AI models interact with external data sources. The Clarity MCP Server acts as a bridge between an LLM (like Claude or GPT) and your Clarity project.
Setup
# Install the Clarity MCP Server
npm install -g @anthropic/mcp-clarity
# Configure with your credentials
mcp-clarity configure \
--token YOUR_CLARITY_API_TOKEN \
--project YOUR_PROJECT_ID
Use Cases
- Ask natural-language questions: "Which pages had the most rage clicks this week?"
- Integrate Clarity data into AI-powered workflows
- Build conversational analytics interfaces
Limitations
The MCP Server uses the same underlying API, so the same rate limits and data retention constraints apply. It's a convenience layer, not a new data source.
Comparison of Export Methods
| Feature | Dashboard CSV | REST API | MCP Server |
|---|---|---|---|
| Automation | No | Yes | Yes |
| Frustration signals | No | Yes | Yes |
| Historical data | 30 days | 3 days | 3 days |
| Rate limit | None | 10/day | 10/day |
| Per-page data | Limited | Full | Full |
| Setup complexity | None | Low | Medium |
| Best for | Quick one-offs | Automated pipelines | AI workflows |
Building a Complete Export Pipeline
For most teams, the ideal setup combines the API with a storage layer. Here's the recommended architecture:
- Daily collection: A cron job calls the API once per day with
numOfDays: 1 - Storage: Data goes into SQLite (simple) or Postgres/Supabase (if you need remote access)
- Analysis: Weekly queries surface trends, anomalies, and regressions
- Reporting: Optional LLM analysis generates plain-English summaries
This is exactly the pipeline that ClarityInsights implements out of the box -- daily collection, persistent storage, and AI-powered weekly reports delivered to your inbox.
Common Pitfalls
Burning Through Rate Limits
With only 10 requests per day, it's easy to exhaust your quota during development. Use numOfDays: 1 for production and save the extra requests for debugging. Cache API responses locally during development.
Missing Data for Low-Traffic Pages
The API returns up to 1,000 rows. If your site has more than 1,000 unique URLs receiving traffic, some pages won't appear in the export. There's no pagination or filtering to work around this -- you get the top 1,000 pages by traffic volume.
Token Expiration
API tokens can expire or be revoked from the Clarity settings panel. Build error handling that alerts you when authentication fails, so your pipeline doesn't silently stop collecting data.
try:
response = requests.post(url, json=payload, headers=headers)
response.raise_for_status()
except requests.exceptions.HTTPError as e:
if e.response.status_code == 401:
# Send alert -- token expired
notify_admin("Clarity API token expired!")
raise
Info: Always store your API token as an environment variable, never in source code. Use a .env file locally and your platform's secrets manager in production.
Stop analyzing Clarity data manually
ClarityInsights sends you AI-powered weekly reports with per-page analysis, frustration signals, and prioritized recommendations.
Join the Waitlist