# Get Live Insights — Microsoft Clarity

> Fetch real-time analytics metrics for your Microsoft Clarity project, optionally broken down by up to three dimensions. Returns an array of metric objects (e.g. Traffic, Scroll Depth, Engagement Time, Dead Clicks, Rage Clicks, Script…

- Key: `microsoft_clarity-get-live-insights`
- Type: Action (Read-only)
- Version: 0.0.2
- App: Microsoft Clarity (`microsoft_clarity`) — https://pipedream.com/apps/microsoft-clarity.md
- This page (HTML): https://pipedream.com/apps/microsoft-clarity/actions/get-live-insights
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/microsoft_clarity/actions/get-live-insights/get-live-insights.mjs

## Description

Fetch real-time analytics metrics for your Microsoft Clarity project, optionally broken down by up to three dimensions. Returns an array of metric objects (e.g. Traffic, Scroll Depth, Engagement Time, Dead Clicks, Rage Clicks, Script Errors) each with a `metricName` and an `information` array of data points. Use `dimension1`, `dimension2`, and `dimension3` to segment data by Browser, Device, Country/Region, OS, Source, Medium, Campaign, Channel, or URL. **Rate limit: 10 requests per project per day — combine all desired dimensions into a single call rather than issuing multiple requests.** Results are limited to 1,000 rows with no pagination. [See the documentation](https://learn.microsoft.com/en-us/clarity/setup-and-installation/clarity-data-export-api)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `numOfDays` | `string` | Yes | The time window for the analytics data. |
| `dimension1` | `string` | No | Primary dimension to group analytics data by (e.g. Device, Country, Browser). Omit for aggregate totals only. |
| `dimension2` | `string` | No | Secondary dimension for cross-segment breakdown (e.g. OS when Dimension 1 is Device). Must differ from Dimension 1. |
| `dimension3` | `string` | No | Tertiary dimension for further segmentation. Must differ from Dimension 1 and Dimension 2. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "microsoft_clarity",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "microsoft_clarity-get-live-insights",
  arguments: {
    numOfDays: "Time Range",
    dimension1: "Dimension 1",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "microsoft_clarity-get-live-insights",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    microsoft_clarity: { authProvisionId: "apn_xxxxxxx" },
    numOfDays: "Time Range",
    dimension1: "Dimension 1",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "microsoft_clarity-get-live-insights",
    "configured_props": {
      "microsoft_clarity": { "authProvisionId": "apn_xxxxxxx" },
      "numOfDays": "Time Range",
      "dimension1": "Dimension 1"
    }
  }'
```

---

- App: https://pipedream.com/apps/microsoft-clarity.md · All apps: https://pipedream.com/apps
