Skip to main content
The Zendesk Chat Cometly integration lets you track chat leads back to their source. It works by passing the Cometly tracking token (the Comet Token, an identifier that links a visitor’s browser session to their attribution data) from your website into a custom field in Zendesk. This matters because a chat lead usually becomes a deal later, inside Zendesk. With the token saved on the lead, Cometly can tie the events you send for that lead back to the ad or channel that brought the visitor to your site, so you can see which ads produce chat leads and sales.

Prerequisites

  • The Cometly pixel (the tracking script you add to your site) is installed on the website where the chat widget runs. The script in step 2 calls cometToken(), which only exists when the pixel is on the page. See Install the Cometly pixel.
  • The Zendesk Chat widget is installed on the same website.

Step 1: Create a custom field for the Cometly tracking token

  1. Log in to your Zendesk account.
  2. In the Admin Center, click Objects and rules.
  3. Select Fields from the menu.
  4. On the Fields page, click Add field.
    Zendesk Fields page with the Add field button circled
  5. Configure the new field:
    • Field type: Select Number.
      Zendesk Add field page with the Number field type highlighted
    • Display name: Enter Cometly_tracking_token.
    • Permissions: Select Customers can edit.
      Zendesk Number field form with the display name and Customers can edit highlighted
    • Title shown to customers: Enter Cometly tracking token.
      Zendesk field form with Title shown to customers highlighted and the Save button circled
  6. Click Save.

Step 2: Copy the custom field ID and add the script to your website

  1. Return to the Fields page.
  2. Find the new Cometly_tracking_token field.
  3. Copy its Field ID.
    Zendesk Fields list with the Field ID of the cometly_tracking_token field highlighted
  4. In the script below, replace UPDATE_WITH_FIELD_ID with the Field ID of your Cometly_tracking_token field.
  5. Copy the script and add it to the <body> of your website, below your Zendesk Chat widget code.
    Make sure the script is below the Zendesk widget code, or it will not work properly.

Step 3: For testing, add the custom field to the default ticket form

  1. Go back to Objects and rules in the Admin Center.
  2. Select Forms.
  3. On the Forms page, click Default Ticket Form.
  4. From the Available ticket fields, find Cometly_tracking_token and move it to the left column to include it in the form.
  5. Click Save.
In an incognito or private browser window, enter a form submission through the widget. The Cometly_tracking_token field is then filled with the token value. Cometly uses this token to track the lead back to the correct source when it receives an event.

Step 4: Send events to Cometly from Zendesk

To send events for new leads, deals created and closed won deals, follow the Zendesk Sell integration guide. It shows where to pass the Cometly_tracking_token field as the Comet Token.

Check it worked

Start a chat through the widget in an incognito or private browser window, then open the ticket in Zendesk: the Cometly_tracking_token field holds a token value. Once you send events from Zendesk as described in step 4, they appear in Cometly under Events Manager, on the Events Log tab.

Frequently asked questions

Does Zendesk Chat send leads to Cometly automatically?

No. The steps on this page only save the Cometly tracking token on the chat lead in Zendesk. To record the lead in Cometly, send an event that includes the token as the Comet Token, for example with Zapier as shown in the Zendesk Sell integration guide.

Why is the Cometly tracking token field empty in Zendesk?

The script can only fill the field when the Cometly pixel is on the same page as the chat widget and the script sits below the Zendesk widget code. Check both, and check that you replaced UPDATE_WITH_FIELD_ID with your Field ID. The script sets the value when the visitor opens the widget, so test with a new chat in a private browser window.

Next steps

Still have questions or need a hand? We’re happy to help. Reach our team at support@cometly.com.