# Join backend events to the visit

Send the visitor id with a sign-up, lead or order from your server, and Zernio adds the ad click ids and browser ids of the website visit behind it.

import { Tab, Tabs } from 'fumadocs-ui/components/tabs';

A sign-up or order sent from your server rarely carries the ad click behind it. Zernio finds the visit on your site and adds its click ids, so the right ad gets the credit.

## Before you start

The [tracking tag](/products/server-side-tracking/install) runs on your site, and the event goes to that site's profile. Once a visitor allows ad storage, the tag sets a first-party `_zid` cookie with their visitor id.

## Send the visitor id

Read `_zid` from the request that created the sign-up or order, keep it with your user, and send it as `user.visitorId`.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
import Zernio from '@zernio/node';

const zernio = new Zernio();

await zernio.conversions.sendEvents({
  body: {
    profileId: '66a1f0c2a4b9d3e8f1a2b3c4',
    events: [{
      eventName: 'CompleteRegistration',
      eventTime: 1798848000,
      eventId: 'signup_u_42',
      user: { email: 'ana@example.com', externalId: 'u_42', visitorId: req.cookies._zid }
    }]
  }
});
```
</Tab>
<Tab value="Python">
```python
from zernio import Zernio

client = Zernio()

client.conversions.send_events(
    profile_id="66a1f0c2a4b9d3e8f1a2b3c4",
    events=[{
        "eventName": "CompleteRegistration",
        "eventTime": 1798848000,
        "eventId": "signup_u_42",
        "user": {"email": "ana@example.com", "externalId": "u_42", "visitorId": request.cookies.get("_zid")},
    }],
)
```
</Tab>
<Tab value="curl">
```bash
curl -X POST "https://zernio.com/api/v1/events" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "profileId": "66a1f0c2a4b9d3e8f1a2b3c4",
    "events": [{ "eventName": "CompleteRegistration", "eventTime": 1798848000, "eventId": "signup_u_42",
      "user": { "email": "ana@example.com", "externalId": "u_42", "visitorId": "4f9c2e1a-7b3d-4c8e-9a1f-2d6b5e8c0a73" } }]
  }'
```
</Tab>
</Tabs>

Store the visitor id with the user, so later events such as a renewal or an upgrade carry it too.

## Without the visitor id

Send the customer's `email`, `phone` or `externalId`. When the tag saw that email or phone typed into a form on your site, or your pages called `zernio('identify', …)`, Zernio finds the visit through it.

## How it behaves

- **Your ids win.** Zernio only adds the click and browser ids the event lacks, and never replaces one you sent.
- **Clicks under 90 days.** A click older than 90 days before the event, or captured after it, is left out.
- **Only with consent.** A visit without ad storage and ad user data consent has no visitor id and is never joined.
- **Before forwarding.** The ids are added before the event is stored and sent, so every destination gets them.
- **Never blocks.** If the lookup is slow, the event goes out as you sent it.
- **One profile.** Zernio joins visits of tracking sites on the event's own profile, and the visitor id itself is never sent to a platform.

## Related

- [Send events](/products/conversions-api/send)
- [Count each conversion once](/products/server-side-tracking/deduplication)
- [Cookies and data](/products/server-side-tracking/cookies-and-data)