# Events and goals

> Track custom events and goals with atrby.track() and atrby.goal(), optionally capture clicks automatically, and turn events into goals.

Canonical: https://atrby.site/docs/events
Last updated: 2026-10-21

Pageviews are automatic. Track anything else with one call.

## Track an event

Call `atrby.track()` when something happens that isn't a page load: a sign-up click, a demo request, a file download.

```js
document.querySelector("#signup").addEventListener("click", () => {
  window.atrby?.track("signup_clicked");
});
```

Use `atrby.goal()` the same way for the actions you report on as conversions. Both count toward a goal with the same name, so the choice only affects how the event is labelled in a visit's timeline.

```js
window.atrby?.goal("trial_started");
```

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Required | The event name. Up to 128 characters; longer names are cut. Use lowercase with underscores so goals are easy to match. |
| `props` | object | Optional | Accepted but not stored yet. Only the name is kept. |

**Properties aren't stored yet.** Pass the detail you need in the name instead, for example `plan_selected_growth`. Each event still carries the page, source, country and device of the visit.

## Clicks without code

Add `data-autocapture="true"` to the script tag to record clicks on links, buttons and any element with a `data-atrby` attribute. They arrive as an event named `click`. The clicked text and link aren't stored.

## Turn events into goals

In the app, open Goals and choose "An event fires" with the event name, or "A page is viewed" with a path. Goals work on past data too, so you can add one after the fact. See [goals and funnels](https://atrby.site/docs/goals-funnels).

## Revenue in the browser

`atrby.revenue(49, { currency: "EUR" })` records a payment from the browser. It counts in the Overview revenue total, but it isn't matched like a processor payment and doesn't appear on the Revenue screen. For real attribution, [connect your processor](https://atrby.site/docs/revenue) or use the [Payment API](https://atrby.site/docs/payment-api).

## Related
- [Identify users](https://atrby.site/docs/identify)
- [Revenue attribution](https://atrby.site/docs/revenue)
- [Script reference](https://atrby.site/docs/tracker)
