---
title: Analytics
description: Track custom events from your deployed app.
category: sdk
order: 5
agent: "@coduck/sdk/analytics. track(name, properties?)->void, or the bound `track` export. Requires CODUCK_API_KEY (server only). Pageviews are captured automatically from nginx logs — use track() for custom events (signups, purchases, etc.)."
---

# Analytics

Track custom events — signups, purchases, feature usage — alongside the pageview data CoDuck already collects for your project.

```ts
import { analytics } from '@coduck/sdk/analytics';

await analytics.track('signup_completed', { plan: 'pro' });
```

Or the bound helper:

```ts
import { track } from '@coduck/sdk/analytics';

await track('checkout_started', { cartValue: 49.0 });
```

| Method | Returns |
|---|---|
| `track(name, properties?)` | `void` |

`properties` is an optional `Record<string, unknown>` of metadata for the event.

> Requires `CODUCK_API_KEY`, so call `track()` from the server (route handler or server action). **Pageviews are recorded automatically** — reach for `track()` only for the custom events that matter to your product.
