Using Intercom with MemberSpace (developers only)

Warning: This guide is for people comfortable with Javascript programming.

If you want to identify your members with Intercom you can utilize the MemberSpace API / Javascript hook to do this.

The base code is as follows.:

<!-- Intercom Install code -->
   <script>
      window.intercomSettings = {
        app_id: "YOUR_APP_ID"
      };
    </script>
    <script>(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/w8vkq0fm';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()
    </script>
    <script>
      (function() {
        MemberSpace.onReady = MemberSpace.onReady || [];
        MemberSpace.onReady.push(function(args) {
          if (args.member) {
            var intercomSettings = {
              app_id: "YOUR_APP_ID",
              id: args.member.id,
              name: args.member.name,
              email: args.member.email,
            };
            Intercom('update', intercomSettings);
          }
        });
      }());
    </script>

  • The first script sets up the global variable intercomSettings with your app. Make sure you replace YOUR_APP_ID with your actual intercom app id.
  • The second script fetches the Intercom Javascript. This uses intercomSettings to start up.
  • The third script uses the MemberSpace API / Javascript Hook. If a member is present we update the Intercom Javascript so you will know who is chatting with you if your member engages with the Intercom chat system. Again, make sure you replace YOUR_APP_ID with your actual Intercom app id in this callback function. 

You can supply more information to Intercom if desired. See our MemberSpace API / Javascript hook for more details on what you have access to. 

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.