start userlike script from ember and fill in user data

This commit is contained in:
Lisa Passing 2015-07-14 16:11:59 +02:00
parent cb4879ef75
commit 052aae3856
2 changed files with 15 additions and 9 deletions

View File

@ -64,7 +64,7 @@ App = Ember.Application.extend(Ember.Evented,
onUserUpdate: (user) ->
if config.pro
@identifyCustomer(user)
@setupCharm(user)
@setupUserlike(user)
@subscribePusher(user)
@ -80,14 +80,21 @@ App = Ember.Application.extend(Ember.Evented,
Travis.pusher.subscribeAll(channels)
setupCharm: (user) ->
$.extend window.__CHARM,
customer: user.login,
customer_id: user.id,
email: user.email
setupUserlike: (user) ->
userlikeData = window.userlikeData = {}
userlikeData.user = {}
displayCharm: ->
__CHARM.show()
userlikeData.user.name= user.login;
userlikeData.user.email = user.email;
console.log(user)
s = document.createElement('script')
s.src = '//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/0327dbb23382ccbbb91b445b76e8a91d4b37d90ef9f2faf84e11177847ff7bb9.js'
document.body.appendChild(s)
# displayCharm: ->
# __CHARM.show()
identifyCustomer: (user) ->
if _cio && _cio.identify

View File

@ -25,6 +25,5 @@
{{content-for 'body-footer'}}
<a href="javascript:void(0)" class="feedback-button" id="userlikeCustomTab" data-right="20" data-bottom="50" data-orientation="top">Do you have a question?</a>
<script type="text/javascript" src="//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/0327dbb23382ccbbb91b445b76e8a91d4b37d90ef9f2faf84e11177847ff7bb9.js"></script>
</body>
</html>