> For the complete documentation index, see [llms.txt](https://docs.sprinthub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sprinthub.com/en/topics/analyze/integrated-webhooks/integrated-webhooks-common-questions/integrated-webhooks-advanced-tracking-identifying-anonymous-leads.md).

# Integrated Webhooks - Advanced tracking, identifying anonymous leads

How to identify and convert anonymous leads via Webhook on a website that has the Sprinthub tracking script.

## Identifying the 'shubid' cookie

When inspecting the website page that contains the [tracking script](https://docs.sprinthub.com/en/getting-started/tracking-script.md), you will see a list of all stored cookies. The cookie used to identify the lead is the `shubid`.

The image below shows this view in Google Chrome:

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FfqAS5D2J09UkTxNVQk3K%2F1.png?alt=media&amp;token=e812becf-1594-4939-bb4b-453527b54e9e" alt=""><figcaption><p><em>Page inspection tool.</em></p></figcaption></figure>

## Getting the page cookies

To view the cookies via code, use the following JavaScript expression in the browser console:

```
Object.fromEntries(
    new URLSearchParams(document.cookie.replace(/; /g, '&'))
);
```

It will return an object with the page cookies, including the `shubid`. With that, the desired cookie will be available as a property of this object, as shown below:

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FWkMC7uS82W6TH8eN8kew%2Fimage.png?alt=media&amp;token=da937511-5304-4106-8538-ad4a7b641af9" alt=""><figcaption><p><em>Getting the cookie via JavaScript.</em></p></figcaption></figure>

{% hint style="info" %}
The way to send or include the cookie in a Webhook or form may vary depending on the platform used. From this point on, it is assumed that the cookie can be sent correctly along with the other lead data.
{% endhint %}

## Webhook: Where to send the cookie

The `shubid` can be sent in the request body and must be mapped as the lead identifier in the 'Identifier To' column. In this way, when the integrated Webhook receives the lead data, it will be identified and it will be possible to configure actions for it in 'Extra Actions'.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FoIKbkE3xFTM6ghefhg3K%2F2.png?alt=media&amp;token=049e5103-0723-433e-80e8-def929361123" alt=""><figcaption><p><em>Request body mapping.</em></p></figcaption></figure>

## Webhook: Automatic Lead Creation

For the lead to be identified and updated automatically when the Webhook is sent, simply enable the 'Enable automatic creation?' option, and match the fields with the keys received in the request.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2F2aTHlUaQB1kfq1EQVfYx%2FScreenshot_1.png?alt=media&amp;token=1ce8ba1a-a93b-4735-8bed-1efeb12ea5d6" alt=""><figcaption><p><em>'Automatic Lead Creation'.</em></p></figcaption></figure>

## Checking the lead history

To verify whether the lead was successfully linked, the history will show when they accessed a page, as well as information such as their location and the devices used to access the tracked website. It is also worth checking whether the data has been updated, such as name, WhatsApp, email, etc.\
\
Now it is possible to verify whether the lead visited specific pages and, based on that, add them to an automation flow or segment, optimizing the customer journey and boosting conversion.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FopaFUpOSb0vzuHsz4srC%2FScreenshot_5.png?alt=media&amp;token=f53e682b-2279-4a00-991f-1b92a793843b" alt=""><figcaption><p><em>Lead history.</em></p></figcaption></figure>
