Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JackGJenkins/b8160e3f237c8d7ea836af83d1a6db09 to your computer and use it in GitHub Desktop.
Save JackGJenkins/b8160e3f237c8d7ea836af83d1a6db09 to your computer and use it in GitHub Desktop.
Simple jQuery snippet to show the Intercom messenger launcher when your user scrolls to the bottom of the page, or clicks a button.
//SHOW THE LAUNCHER WHEN A USER SCROLLS TO THE BOTTOM OF YOUR PAGE
//You'll need to have 'hide_default_launcher: true' defined in your intercomSettings object when the page loads initially.
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == $(document).height()) {
Intercom('update', {"hide_default_launcher": false});
}
});
//SHOW THE LAUNCHER AFTER A USER CLICKS A BUTTON
//You'll need to replace the `#example_ID` used here with the ID of your button,
//or replace the .on() event handler entirely, if showing the messenger launcher after a different event.
$('#example_ID').on('click', function() {
Intercom('update', {"hide_default_launcher": false});
});
@frutality
Copy link

Hi!

When I set hide_default_launcher to "true", I see following error in browser console:

TypeError: valueOf method called on incompatible Object[Learn More] frame.e80299b1.js:1:1355772

There are no errors when I set it to "false". However, widget hides/shows as expected. The only issue is error presence in console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment