# Revenue tracking

> Revenue tracking for custom events: attach an amount and ISO 4217 currency, report it in your site currency with ECB rates, and record refunds.

Add `revenue` (in major units: dollars, euros…) and an ISO 4217 `currency`
to any event:

```js
privatus.track('Purchase', { revenue: 49.99, currency: 'EUR', plan: 'pro' })
```

- `revenue` may be a number or a numeric string (`'49.99'`). It's stored
  exactly, in minor units (cents).
- `currency` defaults to the site's currency when you leave it out.
- Both are removed from the properties and stored as dedicated fields.

## Multi-currency

Each event keeps its original currency and amount. Reports convert revenue
into the **site currency** using the European Central Bank reference rate
for the event's date (falling back to the latest earlier rate). You can
break revenue down by source, campaign, page or any property, in the site
currency.

## Revenue goals

A [goal](/docs/features/goals) can take its value from the event's
revenue, or have a fixed value (for example $50 per lead) when there's no
real revenue.

## Refunds

Send a negative amount with the same currency to record a refund as its
own event, for example `privatus.track('Refund', { revenue: -49.99, currency: 'EUR' })`,
or keep refunds out of analytics and treat revenue as gross.

## Server-side revenue

Purchases confirmed by a payment webhook are more reliable than
thank-you-page events. Send them with the [server-side API](/docs/server-side):

```json
{ "type": "event", "name": "Purchase", "url": "https://example.com/checkout", "revenue": 49.99, "currency": "EUR" }
```
