我正在尝试将对讲机窗口小部件嵌入到静态网页上,但是随后提取用户数据以填充javascript变量以动态填充页面上的内容。主要是,我需要已登录用户的user_id和电子邮件。
任何人都可以提供一个示例,说明如何将JavaScript变量“ userId”(然后可以将其插入页面上的另一个函数)设置为等于对讲机“ user_id”的变量吗?
答案 0 :(得分:0)
请尝试以下方法。这只是一个例子。
<script>
#get the user id
user_id = "<get the user id of the logged in user>";
Intercom('boot', {
'app_id': 'abc12345',
'email': 'john.doe@example.com',
'created_at': 1234567890,
'name': 'John Doe',
'user_id': user_id #user_id of the logged in user
});
</script>
对讲Javascript API-Link