# Custom events

> Send events from your pages with odo() or a data attribute, with properties and revenue, and the events odo sends itself: outbound links, downloads, ad clicks.

Pageviews say where people went. Events say what they did: signed up, started a trial, added to cart.

## From your code

```js
odo('Signup', { plan: 'Pro' })
```

The name is what goals and funnels match, up to 80 characters. Properties are optional, up to 30 of them, each kept as text up to 200 characters. Send what describes the action, never who did it: no names, emails or account ids.

A purchase is an event with `revenue` and a three-letter `currency`:

```js
odo('Purchase', { revenue: 49, currency: 'USD' })
```

It counts as a sale traced to this visit, self-reported. When a payment platform odo reads traces the same sale (the same visitor and currency, about the same amount, within two hours), the platform’s replaces the page’s, so a sale never counts twice. More in [trace each sale to its visit](https://odo.gg/docs/sales-to-visits).

Calls made before the script loads wait for it: see [the early snippet](https://odo.gg/docs/add-the-script#the-early-snippet).

## From your HTML

Any element can send an event when it’s clicked, without code:

```html
<button data-odo-event="Signup" data-odo-prop-plan="Pro">Start</button>
```

Each `data-odo-prop-*` attribute becomes a property.

## Events odo sends itself

| Event | When | Property |
| --- | --- | --- |
| `Outbound link` | A click on a link to another site | `url`, without its query |
| `File download` | A click on a link to a file: PDF, ZIP, DMG, CSV, office documents, audio, video, APK and the like | `url` |
| `Ad click` | A click on a link to one of your ad networks’ domains | `url` |

List your ad networks’ link domains in the website’s settings (**Settings → Websites**, its options). Clicks on links to them then count as **Ad click** rather than outbound links, past clicks too, so they can be goals and funnel steps.

## From your server

Something your server knows (a renewal, an account activated) can be sent with a project key, `POST /api/v1/events`. It joins the visitor’s visit. See the [REST API](https://odo.gg/docs/api#events).

## What each event carried

Tap an event in the **Events** card to see the properties it was sent with, and how often each value came up, for the range and filters on screen.
