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

# LiveChat integration

> Send new chat leads with an email address from LiveChat to Cometly and map them to an event, so you can see which ads produce them.

Set up the [LiveChat](https://www.livechat.com/) integration to send new chat contacts (with email addresses) to Cometly and map them to the event of your choice.

> [!WARNING]
>
> LiveChat is not listed on the **Integrations** page for most spaces. If you do not see a **LiveChat** card there, [contact support](https://docs.cometly.com/support/contact.md).

## How it works

* The snippet you add to your website passes the visitor's Cometly tracking token to LiveChat as a session variable named `cometlyTrackingToken`.
* Whenever a new lead chats through your LiveChat widget, their information is sent to Cometly.
* You map the LiveChat chat to a specific event in Cometly for accurate tracking and attribution.

## Step 1: Connect your LiveChat account

1. In Cometly, click **Integrations** in the sidebar.

2. Find the **LiveChat** card (category **Chat**) and click **Connect**.

3. Click **Sign in with LiveChat** and approve the connection.

   ![LiveChat integration page in Cometly with an arrow on the button that starts the connection](https://mintcdn.com/cometly/gJhojf-axy7BVk83/images/integrations/platforms/livechat/02.webp?fit=max\&auto=format\&n=gJhojf-axy7BVk83\&q=85\&s=7e2bce255679b495315ef306a6a0b372)

When the connection succeeds, the page shows **LiveChat connected**. You can click **Re-sync LiveChat** at any time if you need to connect again.

## Step 2: Add the tracking snippet to your website

So that the `cometlyTrackingToken` is set for new chats:

1. On the LiveChat integration page in Cometly, click **Copy snippet to clipboard**.
2. Add the snippet right below the LiveChat code on your website.

![LiveChat integration page in Cometly with the JavaScript snippet and the copy button highlighted](https://mintcdn.com/cometly/gJhojf-axy7BVk83/images/integrations/platforms/livechat/03.webp?fit=max\&auto=format\&n=gJhojf-axy7BVk83\&q=85\&s=c8ba20a9b084da7b97d16e6246f8f15e)

## Step 3: Map new LiveChat leads to a Cometly event

On the LiveChat integration page, under **Map LiveChat events to Cometly**, choose the Cometly event that new chats should be recorded as (for example, **Chat Lead** or **Lead**), then click **Save**.

![Event mapping card with the LiveChat Chat Created event mapped to the Cometly Lead event](https://mintcdn.com/cometly/gJhojf-axy7BVk83/images/integrations/platforms/livechat/04.webp?fit=max\&auto=format\&n=gJhojf-axy7BVk83\&q=85\&s=8244bba99fc7a9d5637405c749cfb743)

### Choosing the event to map to

When you send **Lead** events to Cometly from LiveChat and from other platforms, consider the following:

1. **If LiveChat leads are already in your CRM**
   * If your CRM (for example, HubSpot) already sends LiveChat leads as part of its **Lead** events, create a separate event in Cometly, such as **Chat Lead**, for LiveChat.
   * This way you see both **Lead** (from your CRM) and **Chat Lead** (from LiveChat) on the contact's timeline, without duplicates.
2. **If leads are sent from several sources**
   * If you send **Lead** events from various sources (for example forms, LiveChat and your CRM), you can include LiveChat leads in the general **Lead** event.

Choose the setup that fits your workflow best to keep your tracking clear and accurate.


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