Skip to content

Instantly share code, notes, and snippets.

View sstern6's full-sized avatar

Scott Stern sstern6

View GitHub Profile
@sstern6
sstern6 / indent_issues.md
Last active September 29, 2016 00:52
Indent Issues - Eslint
@sstern6
sstern6 / gist:11f4e3ff92e0bc4052b1
Last active February 5, 2018 12:53
How To | Implement Intercom with React JS 0.14
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