> AI agents: this is one page of nextanalytica's docs. The full index for agents: https://nextanalytica.app/llms.txt

# Gatsby custom events

> Send custom events from a Gatsby app with @nextanalytica/tag: sign-ups, demo requests and conversions your agent reads by channel.

Updated: 2026-12-01

In Gatsby, send custom events with `track` from `@nextanalytica/tag` in a component's event handler. The Gatsby plugin adds the tag and counts page changes; `track` adds your own events.

## How does it look?

```tsx title="src/components/SignupButton.tsx"
import * as React from "react";
import { track } from "@nextanalytica/tag";

export function SignupButton() {
  return <button onClick={() => track("signup_started", { plan: "team" })}>Start free</button>;
}
```

## What can you ask your agent?

- "Which events happen most this week?"
- "What's the sign-up rate by channel this month?"

## Next steps

- [Gatsby analytics](/docs/platforms/gatsby)
- [Custom events](/docs/tracking/custom-events)

Canonical address: https://nextanalytica.app/docs/platforms/gatsby/events
