Form tracking: Intercom

Updated by Ole Dallerup

This article describes how to set up Intercom chat conversions. It will ensure that when a lead converts on the chat, Dreamdata can associate the web session with the converted lead.

In Intercom, you can monitor instances when a user or lead shares their email address during a chat interaction. Moreover, it is possible to track changes in a lead's email address through webhooks and send the email data to Dreamdata.

Below, we will describe how you could do that using an additional tracking script and Zapier for the webhook.

Tracking on UserEmailSupplied

The following script runs when a user/lead supplies an email address within the Intercom chat. It then associates the anonymous session with Intercom user_id and tracks a formSubmitted event.

Intercom("onUserEmailSupplied", function() {
var intercomUserId = Intercom("getVisitorId");
if (!intercomUserId || !window.analytics) return;

analytics.identify(intercomUserId);
analytics.track("form-submit");
});

You can read the complete documentation on Intercom's documentation page.

Webhook

This can be done via Zapier or custom code using Dreamdata server-side APIs. Read more about Intercom webhooks here.

Zapier

The easiest way of setting this up would be via Zapier. Parsing data from Intercom when "Lead Added Email" to Dreamdata Identify the user associating the user Intercom user_id with the Dreamdata user_id.

As shown in the screenshot below and marked in red boxes, you want to parse the user's email, name, and user_id from Intercom to the Dreamdata Identify. This will ensure that the web session tracked with the tracking script will be associated with the user/lead of the email with the corresponding user_id.

Custom Code

If you are not using Zapier or need more control, it's possible to do the same using Intercom Webhooks and Dreamdata server-side APIs.

In that case, you start by building a service that can listen to the Intercom Webhooks and find the relevant topic(s) to listen to. In the Zapier example, we listened to the contact.lead.added_email topic.

You then have to write some code that transforms the webhook data and calls the relevant Dreamdata server-side tracking APIs. As a minimum, you want to call the Identify API with the user_id and email address set.

If you are using the Dreamdata user_id property to track other kinds of user id's this will likely interfere with that. By default, Dremadata does not use the user_id for anything, however, the purpose of the user_id is to be able to track users with your own managed id's.


How did we do?