Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to integrate intercom.io in my AngularJS application.

The script has some parameters to configure before the full loading:

<script id="IntercomSettingsScriptTag">
  window.intercomSettings = {
    // TODO: The current logged in user's email address.
    email: "[email protected]",
    // TODO: The current logged in user's sign-up date as a Unix timestamp.
    created_at: 1234567890,
    app_id: "95b20cd5364bab3a2136e252d2862b8136aabe7e"
  };
</script>
<!-- Init 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://static.intercomcdn.com/intercom.v1.js';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>

I tried to use {{data.email}} to replace the email but unfortunately, the init script get loaded before the intercomSettings. ng-cloak is not very useful for me because it has been designed only for presentation purposes.

I am not sure in which direction I should look for. To test my code: http://plnkr.co/edit/2PJNLukBx0cTOPZXNwqs?p=preview

You should get a little question mark at the bottom right of the window if it works.

share|improve this question

2 Answers 2

I'm not sure if you already found a solution, but you should take a look on this:

https://github.com/maxiperezc/angular-intercom it basically wrapped intercom script into angular, so you can use within your application using directives.

This is an improved version of https://github.com/gdi2290/angular-intercom - they removed some unnecessary code

share|improve this answer

I updated angular-intercom to the latest intercom api if you're still interested. The service has been simplified for the user with a better way of handling async script loading https://github.com/gdi2290/angular-intercom

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.