# Match events to people

> An event is worth what it can be joined to. Send every way you have to name the person in `user_data`: the `baker_id` a Baker page gave the browser, an email or phone (plain or SHA-256), your own `external_id`, an ad click id, or Meta's `fbp` and `fbc`. Baker joins the event to the visits and the campaign that person came from.

Source: https://withbaker.com/docs/identity · Updated 2026-11-23

## Why it matters

A deal is only useful to Baker if it can find the campaign that earned it. That join runs through the person: the same email filled in on a landing, the same browser that clicked an ad. `user_data` is required for that reason, and an event that names nobody is refused with `missing_identity`. The one exception is a `page_view` with a `url`, because a page served is a fact about a page.

## The ways to name a person, best first

1. **`baker_id`**: the id a Baker page already gave this browser. It names the visit itself, so the event lands on that person's timeline. Send it if your system kept it, for example from a hidden form field.
2. **`email` or `phone`**: the road that cannot silently fail. Send them plain if you can: Baker normalises and hashes them exactly as its pages and pixel do, so they land on the same person.
3. **`external_id`**: your own id for the person, such as a CRM contact id. It joins your events to each other; sent once beside an email or a `baker_id`, every later event with only the contact id joins the person too, including the ones already sent.
4. **A click id, `fbp` or `fbc`**: the ad click or browser that brought them. Enough on its own, and what attributes the event to a campaign.

> **Tip:** Send every one you have, not only the best. Each is another chance to match, and they cost nothing extra.

A value that is not what its field says names nobody: an `email` with no `@`, a `phone` with no digits. If it was the only one, the event is refused with `missing_identity`, so check what your system really holds in those fields.

## Hashed emails and phones (SHA-256)

If your policy forbids sending an email or a phone in the clear, send its SHA-256 digest, as 64 lowercase hex characters, **in the same field**. Baker tells a digest from a plain value on its own: there is no separate `email_sha256` field.

Hash exactly what Baker hashes, or the digest names nobody: for an email, trim it and lower-case it; for a phone, keep the digits with a leading `+` and the country code (`+34600111222`).

**Node.js**

```js
import { createHash } from "node:crypto";

const sha256 = (value) => createHash("sha256").update(value).digest("hex");

const email = sha256(" Laura@Example.com ".trim().toLowerCase());
const phone = sha256("+34 600 111 222".replace(/[^\d+]/g, ""));
```

**Python**

```python
import hashlib
import re

def sha256(value):
    return hashlib.sha256(value.encode()).hexdigest()

email = sha256(" Laura@Example.com ".strip().lower())
phone = sha256(re.sub(r"[^\d+]", "", "+34 600 111 222"))
```

## The matching fields

`first_name` through `country` never name a person on their own, so they never satisfy `user_data` by themselves. Send them anyway when you have them: they are what Meta's advanced matching and Google's enhanced conversions match on, so Baker can pass the event on to your ad platforms without asking your CRM again.

| Field | Meta | Google | Kept as |
| --- | --- | --- | --- |
| `email` | `em` | `hashed_email` | SHA-256 |
| `phone` | `ph` | `hashed_phone_number` | SHA-256 |
| `external_id` | `external_id` |  | Plain text |
| `first_name` | `fn` | `hashed_first_name` | SHA-256 |
| `last_name` | `ln` | `hashed_last_name` | SHA-256 |
| `date_of_birth` | `db` |  | SHA-256 |
| `gender` | `ge` |  | Plain text |
| `street` |  | `hashed_street_address` | SHA-256 |
| `city` | `ct` | `city` | Plain text |
| `region` | `st` | `state` | Plain text |
| `postal_code` | `zp` | `postal_code` | Plain text |
| `country` | `country` | `country_code` | Plain text |
| `fbp` | `fbp` |  | Plain text |
| `fbc` | `fbc` |  | Plain text |

## Consent

If your site asked the person, send what they chose in `consent`. `analytics: denied` keeps the event in your counts and forgets who it was. `marketing: denied` keeps it in your reports and never matches it to an ad platform or sends it to one. Absent means you did not say.

## Need help?

Write to support@withbaker.com: a person answers within 24 hours. The OpenAPI description is at https://withbaker.com/docs/openapi.json.
