Skip to main content
Install Intercom with Google Tag Manager

How to install the Intercom Messenger using Google Tag Manager — no code required.

Beth-Ann Sher avatar
Written by Beth-Ann Sher
Updated over a week ago

Google Tag Manager (GTM) is a simple solution for managing tags, and JavaScript snippets, that send data to third parties (like Intercom) from your website or app. You can easily add or remove code snippets without requiring a developer to update any code.

Installing Intercom this way enables you to better understand your customers by tracking the actions they take on your site and app. It’s also the simplest way to load the Intercom Messenger on your website.

You can install Intercom with GTM for:

This will give your customers a consistent Intercom experience, and allow you to track their entire journey from new visitor to signed up user.

See additional methods below for more information on updating Intercom when a user logs in or signs up.

Google Tag Manager allows you to implement any of the methods in the Intercom Javascript API without writing a line of code. Things like:

Note:

  • You must have Google Tag Manager installed on your website.

  • You’ll need permissions to edit your website’s Google Tag Manager configuration. If you’re unsure who owns your Google Tag Manager account, check with the team or person who manages your website, SEO or marketing operations.


Install Intercom with GTM for logged out visitors on your website

From the Tags section of your GTM account, click New to create a new tag.

Give your tag a name, like “Intercom Messenger”, then edit the Tag configuration.

Next, click "Discover more tag types in the Community Template Gallery".

Now, search for "Intercom", and select Intercom (by Intercom).

Next, click Add to workspace.

Then, confirm you’d like to add the Intercom tag. This will take you back to the tag configuration screen.

From here, choose the Install method, and open the Method Arguments tab.

Paste your Intercom workspace ID into the “Workspace ID” field:

After adding your workspace ID, open the ‘Triggering’ section, and choose the trigger for loading the Messenger.

You can choose an existing trigger, or create a new one with the ‘+’ icon in the top right:

For optimal user experience we recommend choosing “Window Loaded”, so your website loads as fast as possible.

Your tag is now configured for logged out users. 🎉

All that is left to do is to “Submit” the changes to your container for them to take effect. However, it is highly recommended to verify your work using “Preview” mode beforehand.


Install Intercom with GTM for logged in users of your website

The first steps to installing Intercom with GTM for logged in users are the same as above, so you’ll need to complete them first, then continue. 👇

When your website loads — Trigger the Intercom tag with the 'Install' method including the user's details if they are already logged in.

If they log in later, trigger the same tag again, with the 'Update' method, and include the user's details (outlined below).

In the tag configuration screen, below ‘Method Arguments’ you’ll see ‘Data attributes’. Use these to identify the currently logged in user, by providing a variable for ‘User ID’ or ‘User Email’.

Never enter a specific user ID or email address in these fields, as this will incorrectly identify all your users as the same person, and skew your Intercom data.

You can also include variables here for additional standard attributes like:

  • When the user signed up (as a Unix timestamp).

  • The user’s first and last name.

  • Their phone number.

  • A unique user hash (if you use identity verification).

  • A URL to the user’s avatar image (must be HTTPS).

Tracking custom data about your users

Additionally you’ll see "Custom Data Attributes", where you can track any other information that’s important to your business.

By default, any attribute added this way will be treated as a string value in Intercom. To support integers or booleans you can create a variable in GTM, which returns a non-string value. Like this example, which returns the boolean TRUE:

Tracking information about a user’s company

You can track company information for each logged in user, under ‘Company Attributes’. Just add a variable for each attribute, and these will be passed to Intercom.

Company ID and company name are the minimum requirements to track a company in Intercom. Learn more about grouping your users by company here.

Your tag is now configured to track logged in users of your app. 😎

If you have trouble identifying or tracking logged in users, tracking custom events, or triggering Intercom methods with custom tags that rely on GTM's data layers we recommend getting support from Google directly.


Installing Google Tag Manager with Regional Data Hosting

This app uses a code-less method to install the Intercom Messenger. If you'll be using GTM with an EU/AU hosted workspace, you'll need to pass "api_base" as a custom data attribute, under the "tracking custom data about your users" section with the regional value:


Additional methods for a comprehensive integration

Intercom’s GTM template offers additional methods you can implement for a flexible and sophisticated solution.

These are all the same methods available with the JavaScript API, but can be implemented with no code required.

You’ll find these in the ‘Method’ drop down:

The available methods are:

  • Install (covered above)

  • Boot — Useful in situations where you'd like to control when Intercom is loaded.

  • Shutdown — Call this method to clear your users’ conversations anytime they log out.

  • Update — Update Intercom when a visitor signs up or logs in, or any time their data changes. - Perfect for use in a Single Page App (SPA).

  • Hide & Show — Conditionally display the Messenger based on actions your customers take.

  • Show New Message — Start a new conversation in the Messenger, with an optional pre-populated message. - Perfect for replacing forms on your website.

  • On Hide & On Show — Trigger events in GTM when the Messenger is shown or hidden.

  • On Unread Count Change — Trigger events in GTM when your customers receive a new message.

  • Track Event — Record actions your customers take and send them to Intercom, with optional metadata.

  • Start Tour — Trigger a Product Tour based on an action your customer has taken.

Example uses for these methods

Here are some example use cases for the additional Intercom methods.

These examples may require creating custom tags in Google Tag Manager, if you’re not already tracking the events needed to trigger the method.

E.g. This is a custom tag in GTM that recognizes when a visitor shows signs of leaving your website and tracks the event ‘exit_intent’, which we’ll use in the first example:

Send a Product Tour when a visitor is about to leave your site

To capture your visitors’ attention with a Product Tour when they’re about to leave your site, select the method ‘Start Tour’, and enter the ID of the tour you’d like to send:

The ID of the tour can be found in the “Use tour everywhere” section of the tour editor.

Then, in the ‘Triggering’ section, select the ‘exit_intent’ event as mentioned above 👆

Save your tag, and next time a visitor goes to leave your site, they’ll receive your Product Tour:

You can apply the same logic to different triggers, like when a visitor scrolls to a certain part of the page, or clicks a link.

Start a conversation when a user submits a form, or clicks a button

You might want to bring a conversation from your site into the Messenger so Custom Bots, or Custom Answers can take over. To do this, choose the ‘Show New Message’ method, and optionally add a pre populated message:

👆This example uses the subject line from a contact form.

Then, select the right trigger for your use case, E.g. when a visitor clicks a button to ‘Talk to sales’, or when someone submits your contact form, like in this example:

Now whenever the contact form is submitted it starts a new conversation in the Messenger:


Implementing Identity Verification on Google Tag Manager

Google Tag Manager is the method by which you send data about your users to Intercom. When you enable Identity Verification, you're essentially sending one more value along with each request - a unique user hash calculated using your secret key (found in your installation settings) and your choice of user identifier (user_id or email address).

You create these hashes in your own backend code and then submit them to Google Tag Manager as you would any other value. You need to call it "user_hash".


Getting support with Google Tag Manager

If you have trouble identifying or tracking logged in users, tracking custom events, or triggering Intercom methods with custom tags that rely on GTM's data layers we recommend getting support from Google directly.


💡Tip

Need more help? Get support from our Community Forum
Find answers and get help from Intercom Support and Community Experts


Did this answer your question?