Skip to main content
Zendesk Chat Integration

Learn how to send leads from your Zendesk Chat widget to Cometly.

Updated this week

Integrating Zendesk Chat with Cometly enables seamless tracking of customer interactions, including passing the Cometly tracking token from your website to the Zendesk app. Follow these step-by-step instructions to set up the integration.


Step 4: Create a Custom Field for the Cometly Tracking Token

  1. Access your Zendesk account using your login credentials.

  2. In the Admin Center, click on Objects and rules.

  3. Select Fields from the menu.

  4. On the Fields page, click the Add field button.

  5. Configure the new field:

    • Field type: Select "Number."

    • Name: Enter Cometly_tracking_token

    • Customer permissions: Select Customer can edit.

    • Title shown to customers: Enter Cometly tracking token.

  6. Click Save to finalize the custom field.


Step 5: Copy the Custom Field ID & Add Script to </body> of Website

  1. Return to the Fields page.

  2. Locate the newly created Cometly_tracking_token field.

  3. Copy the Field ID and paste it into the Cometly script.

  4. To configure the script properly, replace UPDATE_WITH_FIELD_ID in the code below with the field ID of your cometly_tracking_token field.

    <script type="text/javascript">
    let cometToken;

    try {
    cometToken = cometToken();
    try {
    zE("messenger:on", "open", function() {
    zE("messenger:set", "conversationFields", [
    { id: "UPDATE_WITH_FIELD_ID", value: cometToken }
    ]);
    });
    } catch (error) {
    console.error("Error Zendesk Widget is not set:", error);
    return;
    }
    } catch (error) {
    console.error("Error getting comet token:", error);
    return;
    }
    </script>


    See an example below of what it should look like:

  5. Copy the code below and add to the <body> of your website BELOW your Zendesk Chat widget code. Ensure it's below the Zendesk Widget code or it will not work properly.


Step 6: For Testing, Add the Custom Field to the Default Ticket Form

  1. Navigate back to Objects and rules in the Admin Center.

  2. Select Forms.

  3. On the Forms page, click on 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 to apply your changes.

In an incognito browser or private window, enter a form submission through the widget and you will see the cometly_tracking_token updated with the token value. The token value will be essential for tracking the lead back to the correct source when we receive an event.


Step 7: Send Event to Cometly from Zendesk

Please see our Zendesk integration article to learn how to send events for new leads, deals created, and closed won.

Did this answer your question?