This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Disclaimer : I was using Webpack with React/Flux, this is just an implementation that I got to work. Many other ways you could do this. | |
-Reference Intercom for more information on implementation: https://docs.intercom.io/install-on-your-web-product/integrating-intercom-in-one-page-app | |
Step 1) create 2 files in your apps root, chat.js and intercom.js. | |
Step 2) In chat.js paste in the JS library file given to you in the docs, but replace {app_id} with your actually app_id: | |
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true; | |
s.src='https://widget.intercom.io/widget/{app_id}'; | |
var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,fa |