# Track Event — Dreamdata

> Record an action a user performed. Either a User ID or an Anonymous ID is required. See the documentation.

- Key: `dreamdata-track-event`
- Type: Action (Write)
- Version: 0.0.2
- App: Dreamdata (`dreamdata`) — https://pipedream.com/apps/dreamdata.md
- This page (HTML): https://pipedream.com/apps/dreamdata/actions/track-event
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/dreamdata/actions/track-event/track-event.mjs

## Description

Record an action a user performed. Either a User ID or an Anonymous ID is required. [See the documentation](https://developer.dreamdata.io/server-side/server-side-tracking/).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `event` | `string` | Yes | Name of the action the user performed (e.g. Signed Up, Booked Demo). |
| `userId` | `string` | No | Unique identifier for the user in your database. Either a User ID or an Anonymous ID is required. |
| `anonymousId` | `string` | No | A pseudo-unique substitute for a User ID, for cases when you don't have an absolutely unique identifier. Either a User ID or an Anonymous ID is required. |
| `properties` | `object` | No | Free-form dictionary of properties for the event, e.g. { "revenue": 99.0, "currency": "USD" }. |
| `messageId` | `string` | No | A unique identifier for this message. Defaults to a generated UUID if omitted. Use a deterministic value to make calls idempotent. Example: msg_order_2026_05_27_0001. |
| `timestamp` | `string` | No | ISO-8601 timestamp when the event took place. Defaults to the current time if omitted. Example: 2026-05-27T17:32:11.318Z. |
| `context` | `object` | No | Dictionary of extra information about the message that is not directly related to the API call, such as IP address, user agent, page, or campaign UTM parameters. Example: { "ip": "203.0.113.1", "userAgent": "Mozilla/5.0", "page": { "url": "https://example.com/pricing" }, "campaign": { "utm_source": "google" } }. See Segment-compatible context spec. |
| `integrations` | `object` | No | Dictionary of downstream destinations to either enable or disable for this event. Example: { "all": false, "Google Analytics": true, "HubSpot": false }. |

## 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": "dreamdata",
      },
    },
  },
)

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: "dreamdata-track-event",
  arguments: {
    event: "Event Name",
    userId: "User ID",
  },
})
```

**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: "dreamdata-track-event",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    dreamdata: { authProvisionId: "apn_xxxxxxx" },
    event: "Event Name",
    userId: "User ID",
  },
})

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": "dreamdata-track-event",
    "configured_props": {
      "dreamdata": { "authProvisionId": "apn_xxxxxxx" },
      "event": "Event Name",
      "userId": "User ID"
    }
  }'
```

---

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