> ## Documentation Index
> Fetch the complete documentation index at: https://docs.segmentstream.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sending website lead data to your CRM

> Send the SegmentStream user identifier along with lead data to your CRM for consistent attribution across consented and non-consented users.

> [!TIP]
>
> Before you continue, implement the [SegmentStream SDK](https://docs.segmentstream.com/project-configuration/sdk.md) snippet on your website.

When sending lead data from your website to your CRM, you should also send the user identifier provided by the SegmentStream SDK.

Instead of using the `_ga` cookie value, pass the value returned by the following method:

```javascript theme={null}
window.segmentstream.anonymousId()
```

* If the user has consented to cookies, this method will return the `_ga` cookie value.
* If the user has **not** consented, it will return a generated anonymous ID (instead of `null`).

This approach ensures that SegmentStream's aggregated attribution works for both consented and non-consented users.

## How to implement

**1. Replace the \_ga cookie**

If your CRM currently receives the `_ga` cookie value, replace it with `window.segmentstream.anonymousId()`.

**2. If replacement is not possible**

Send the `anonymousId()` value to a separate field in your CRM.

**3. Trigger the conversion event on the same page**

On the same page where the lead is sent to the CRM, you must also call `window.segmentstream.conversion({ type: 'lead' })`.

> [!WARNING]
>
> Calling the conversion method on a different page, for example, a redirect page after the lead is sent, will **not** work for aggregated conversion attribution. The call must happen on the same page where the lead is submitted.

**4. Usage example**

```javascript theme={null}
// code that sends data to the CRM
const clientId = window.segmentstream.anonymousId();
sendLeadToCRM({
    name: leadName,
    email: leadEmail,
    clientId: clientId
});

// code that sends data to SegmentStream
window.segmentstream.conversion({
    type: 'lead'
});
```

This ensures consistent attribution coverage while remaining compliant with privacy regulations.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.