我有一个react应用程序,我在其中附加了一个zendesk脚本,只有在某种类型的用户登录时才会显示。
我还想使用Zendesk建议的自动登录:
https://developer.zendesk.com/embeddables/docs/widget/api#content
=>大小标识
我不知道怎么做。这是我的plugin zendesk代码,我需要在后面附加它:
// Specify which user can have Zendesk
if (this.props.user.organisation === "organisationName") {
// Start of Zendesk Chat Script
const script = document.createElement("script");
script.src = "myzendesklink";
script.async = true;
script.id = "zendesk"
console.log()
document.body.appendChild(script);
//Something here for login
const scriptLogin = document.createElement("script");
document.body.appendChild(scriptLogin);
// End of Zendesk Chat Script
}
以及我要附加的代码:
<script>
zE(function() {
zE.identify({
name: 'John Citizen',
email: 'john@example.com',
organization: 'VIP'
});
});
</script>
第一部分是好的和工作,但第二部分我正在努力。
如果有人知道如何附加这个脚本,我很高兴知道:),感谢社区