Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the Intercom chat widget in specific pages in a single page application (SPA)?

Consider a single page application written in vanilla JS (to avoid framework-specific answers).

I have an app in which I load Intercom by default, but I want to hide the widget in specific pages.

That should be doable from Intercom itself, as shown in this article in their help center, but it doesn't really work in single page apps - the widget is shown no matter what is configured in Intercom.

One option would be to find the widget on page and hide it manually for the given pages, but that feels, sounds and tastes like a hack (it requires re-enabling the widget when going back to page where the widget is supposed to appear).

So, is there any good practice on how to do it for SPAs?

like image 915
Gilberto Torrezan Avatar asked Aug 07 '19 07:08

Gilberto Torrezan


People also ask

How do I hide Intercom chat?

You can turn off the Intercom Messenger launcher in your Messenger settings. Just deselect the option to show the standard launcher to users or visitors. This disables the launcher in your app (or on your website) which allows your users to contact you, and see their past conversations with you.

How do you hide your location on intercom?

To hide your location, hover over your avatar in the bottom left corner, and click your name: This will take you to your individual profile settings. From here, click 'Edit. ' Then select the 'Hide location from users' button and click 'Done.

How do I change the welcome message in intercom?

Extend a warm welcome. You should greet customers by their first name by adding a first name variable. Introduce yourself. And don't forget to add a smiling avatar of your face to show the real person behind your product.


2 Answers

If you want to hide the intercom launcher programmatically, you can do this with the update command.

To hide:

Intercom('update', {
  "hide_default_launcher": true
});

And to show it again (when your next page loads, or the event is triggered that should show it).

Intercom('update', {
  "hide_default_launcher": false
});

I used this exact technique in an angular SPA to hide it on screens where it was obscuring some buttons.

like image 195
rickerbh Avatar answered Oct 13 '22 13:10

rickerbh


Intercom('update', {
     "hide_default_launcher": true
});
$(".helpSupport").once().on("click", function() {
     Intercom('update', {
        "hide_default_launcher": false
     });
      Intercom('showMessages');
});
like image 2
Wasim Khan Avatar answered Oct 13 '22 12:10

Wasim Khan