# Create Tracked Event — ActiveCampaign

> Tracks an event using event tracking. See the docs here.

- Key: `activecampaign-create-tracked-event`
- Type: Action (Write)
- Version: 0.2.2
- App: ActiveCampaign (`activecampaign`) — https://pipedream.com/apps/activecampaign.md
- This page (HTML): https://pipedream.com/apps/activecampaign/actions/create-tracked-event
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/activecampaign/actions/create-tracked-event/create-tracked-event.mjs

## Description

Tracks an event using event tracking. See the docs [here](https://developers.activecampaign.com/reference/track-event).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `key` | `string` | Yes | This value is unique to your ActiveCampaign account and can be found named "Event Key" on Settings > Tracking > Event Tracking inside your ActiveCampaign account. |
| `event` | `string` | Yes | The name of the event you wish to track. |
| `eventdata` | `string` | No | A value you wish to store for the event. |
| `actid` | `string` | Yes | This value is unique to your ActiveCampaign account and can be found named "actid" on Settings > Tracking > Event Tracking API. |
| `visitEmail` | `string` | Yes | Email address of the contact you wish to track this event for. |

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

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: "activecampaign-create-tracked-event",
  arguments: {
    key: "Key",
    event: "Event",
  },
})
```

**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: "activecampaign-create-tracked-event",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    activecampaign: { authProvisionId: "apn_xxxxxxx" },
    key: "Key",
    event: "Event",
  },
})

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": "activecampaign-create-tracked-event",
    "configured_props": {
      "activecampaign": { "authProvisionId": "apn_xxxxxxx" },
      "key": "Key",
      "event": "Event"
    }
  }'
```

---

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