# Retrieve Link Analytics — TinyURL

> Retrieves analytics for a specific TinyURL link, including total clicks, geographic breakdowns, and device types. See the documentation

- Key: `tinyurl-retrieve-link-analytics`
- Type: Action (Read-only)
- Version: 0.0.2
- App: TinyURL (`tinyurl`) — https://pipedream.com/apps/tinyurl.md
- This page (HTML): https://pipedream.com/apps/tinyurl/actions/retrieve-link-analytics
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/tinyurl/actions/retrieve-link-analytics/retrieve-link-analytics.mjs

## Description

Retrieves analytics for a specific TinyURL link, including total clicks, geographic breakdowns, and device types. [See the documentation]()

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `domain` | `string` | Yes | The domain you would like the TinyURL to use. Select from TinyURL free domain tinyurl.com or subscribe and use TinyURL branded domains. |
| `urls` | `string` | Yes | The existing alias for this TinyURL Options are loaded from the connected account. |
| `from` | `string` | Yes | The start datetime of analitics report |
| `to` | `string` | No | The end datetime of analitics report. Default is now |
| `tag` | `string` | No | Tag to get analytics 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": "tinyurl",
      },
    },
  },
)

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: "tinyurl-retrieve-link-analytics",
  arguments: {
    domain: "Domain",
    urls: "Alias",
  },
})
```

**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: "tinyurl-retrieve-link-analytics",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    tinyurl: { authProvisionId: "apn_xxxxxxx" },
    domain: "Domain",
    urls: "Alias",
  },
})

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": "tinyurl-retrieve-link-analytics",
    "configured_props": {
      "tinyurl": { "authProvisionId": "apn_xxxxxxx" },
      "domain": "Domain",
      "urls": "Alias"
    }
  }'
```

---

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