# Custom events and goals

> Count signups, purchases and button clicks with datacenter() custom events, then turn events and pages into goals you can see in the dashboard.

Source: https://datacenter.so/docs/custom-events-and-goals
Section: Measure

Pageviews tell you who came. Events and goals tell you who did something.

## Send a custom event

Once the script is on the page, call `datacenter` with an event name.

```js
datacenter('Signup');
```

You can add details as props. Keep values short: plain strings or numbers.

```js
datacenter('Purchase', { plan: 'Pro', value: 49, currency: 'USD' });
```

Events from the browser count toward your monthly allowance like pageviews. [Automatic events](https://datacenter.so/docs/automatic-events), such as outbound link clicks and file downloads, are free and need no code.

The script loads with `defer`, so call `datacenter` from code that runs after the page has loaded, such as a click handler or a form's submit handler.

## Make a goal

A goal is something you want to count as a win, like a sale or a signup. Open the site, then **Goals**. The common goals take one tap and no code:

| Goal | Counts | What it needs |
|---|---|---|
| Someone buys | Each paid order (the `Purchase` event) | [Stripe](https://datacenter.so/docs/stripe-connector) or [Shopify](https://datacenter.so/docs/shopify-connector) connected, the [Events API](https://datacenter.so/docs/events-api), or `datacenter('Purchase')` |
| Someone fills in a form | Each form sent with an email or phone field (the `Form sent` event) | 90-day tracking. Adding the goal turns on [form capture](https://datacenter.so/docs/customer-profiles#people-from-sign-ups-and-forms) |
| Someone books or calls | Taps on your phone number, email address and booking links such as Calendly and Cal.com (the `Book or call` event) | 90-day tracking. Adding the goal turns on tap counting |
| Someone reaches a thank-you page | Visits to the page people see after they buy or sign up | Nothing. Pick the page from your own pages, or type it |

Form sent and Book or call come from a small add-on that the 90-day tag loads only while its switch is on. Like the rest of 90-day tracking, it sends nothing until the visitor agrees when **Wait for consent** is on. Booking links count when a visitor taps a link or button that opens them. A booking made inside an embedded Calendly widget counts too.

### Custom goals

Under **Custom goal** there are two kinds.

| Kind | Counts when |
|---|---|
| A page is visited | A visitor opens a matching path, such as `/thanks`. Use `*` for any part, like `/blog/*` |
| An action happens | An event with this name arrives, such as `Signup` |

A site can have up to 20 goals, and your plan may allow fewer. A new goal counts past visits too.

### Edit, archive or give a goal a value

- **Edit** changes a goal's name and what it matches. Past visits are counted again with the new rule.
- **Value per conversion** is optional: what one conversion is worth to you, in a currency you pick. The Goals card then shows what each goal brought in and a total.
- **Archive** takes a goal off your dashboard and reports and frees its place on your plan. Its rule stays, so **Restore** brings it back with its history. Archived goals can be deleted for good.

## See goals in the dashboard

Each goal shows its conversions and its conversion rate: the share of visitors who reached it. Filter by source, campaign or short link to see which one brought the people who converted.

## Send a goal to Meta

On the site's **Integrations** page (under **Settings**), tick a goal under **Goals to send** and its conversions go to the Meta Conversions API, from the browser and from your server. See [Meta Conversions API](https://datacenter.so/docs/meta-conversions-api).

## Events from your server

Some events only your server knows about, like a paid order. Send those with the [Events API](https://datacenter.so/docs/events-api).
