Informizely Informizely + Intercom Intercom Intercom Integration

There are various ways to integrate your Informizely survey with Intercom, among which:

We'll discuss these below.

Open the Intercom chat window from within an Informizely survey

This can be done using a "timed action". When the user provides an answer to a question that you want to trigger the Intercom messenger, e.g. an answer to a single choice question or the click of a button, navigate to a survey page that has a timed action to open the Intercom chat window, either immediately or after a specified number of seconds.

To add a timed action to a survey page, click the "Add a timed action" button for the page in the survey builder, select "Open chat window" as action in the dialog, and then select "Intercom" as "Chat tool".

Intercom Integration
If you want to pre-populate the Intercom chat window with a message you can select "Execute JavaScript" and enter the following as the JavaScript code to execute: Intercom('showNewMessage', '<replace this with your message>').

You can read more about timed actions here.

Embed a survey question in Intercom messenger

To embed an Informizely survey in Intercom messenger you should create an "Email Survey" for app "Intercom". After editing and publishing the survey you can copy the HTML for the first question on the survey's settings page and paste it directly for use in Intercom. You can also copy only the answer links, so that you can use them as is, or style and modify them to your liking.
For embedded email surveys, optional follow-up questions to the initial embedded question are asked in a full-page survey on the Informizely site.

Use the Intercom Visitor ID as User ID for survey responses

Using our Javascript API you can associate a User ID (and other properties) with survey responses. To use Intercom's Visitor ID as User ID for responses, add the following code directly above the standard Informizely code snippet that loads your site configuration:

<script type="text/javascript">
	var IzWidget = IzWidget || {};
	IzWidget['insitez.ready'] = function (api) {
		api.set('userId', Intercom('getVisitorId'));
	};
</script>

Track survey events in Intercom

Using Informizely's event tracking integration it is easy to record survey events in Intercom, just call Intercom('trackEvent', event-name, optional-metadata) when the survey events that you want to track occur. You can choose your own event names and metadata, the example below provides a possible implementation:

<script type="text/javascript">
    function informizelyEvent(event, surveyId, surveyName, data, api)
    {
        // You can do anything that you want here. This implementation sends some event data to Intercom.
        switch (event) {
            case "SurveyStart":
                Intercom('trackEvent', 'informizely-survey-shown', {
                            survey_id : surveyId,
                            survey_name: surveyName
                        });
                break;
            case "ButtonClicked":
            case "ImageClicked":
            case "LinkClicked":
                Intercom('trackEvent', 'informizely-cta', {
                            survey_id : surveyId,
                            survey_name: surveyName,
                            cta: event,
                            cta_id: data.itemId,
                            url: data.url
                        });
                break;
            case "SurveyDone":
                Intercom('trackEvent', 'informizely-survey-done', {
                            survey_id : surveyId,
                            survey_name: surveyName,
                            completed: data.completed
                        });
                // You can call 'api.getResults()' here to retrieve and process the answers to all questions.
                // See the documentation for the event tracking integration for more information.
                break;
            case "Initialized":
            case "PageShown":
            case "SurveyEnd":
            case "SurveyMinimized":
            case "SurveyMaximized":
            default:
                // Not tracked in this example.
                break;
        }
    }

    var IzWidget = IzWidget || {};
    IzWidget['tracker'] = informizelyEvent;

    // Add the normal Informizely code snippet below.
    (function (d) {
        ...	
    }) (document);
</script>