> ## 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](/project-configuration/sdk) snippet on your website.
</Tip>

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

<Steps>
  <Step title="Replace the _ga cookie">
    If your CRM currently receives the `_ga` cookie value, replace it with `window.segmentstream.anonymousId()`.
  </Step>

  <Step title="If replacement is not possible">
    Send the `anonymousId()` value to a separate field in your CRM.
  </Step>

  <Step title="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.
    </Warning>
  </Step>

  <Step title="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'
    });
    ```
  </Step>
</Steps>

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