$zopim 未定义
$zopim is not defined
正在阅读 the documentation Zopim(a.k.a Zendesk Chat):
API calls must be inserted after the Live Chat Script and wrapped within $zopim(function() { ... })
所以我在 HTML 的 head
部分有一个 Zopim 脚本:
<script>/*<![CDATA[*/window.zEmbed||function(e,t){ ... }("https://...);
/*]]>*/</script>
然后我在 HTML 文档的末尾添加了这个:
$zopim(function() {
$zopim.livechat.setName('Logged in name');
$zopim.livechat.setEmail('user@somewhere.com');
});
控制台说:
$zopim is not defined
我想我the instructions 是正确的。我错过了什么?
我找到了更好的解决方案(在提交支持请求后)
zE(function() {
$zopim(function() {
$zopim.livechat.setName("{{\Auth::user()->name}}");
$zopim.livechat.setEmail("{{\Auth::user()->email}}");
});
});
我在 Zendesk Support 中使用了 Zendesk 聊天代码,这就是为什么我需要添加 Ze 功能以使其使用 api。
编辑: 检查 from Jay Hewitt and also his .
这将循环,等待加载 $zopim 和 $zopim.livechat。
一旦加载完毕,它将停止循环。
var waitForZopim = setInterval(function () {
if (window.$zopim === undefined || window.$zopim.livechat === undefined) {
return;
}
$zopim(function() {
$zopim.livechat.setName("{{\Auth::user()->name}}");
$zopim.livechat.setEmail("{{\Auth::user()->email}}");
});
clearInterval(waitForZopim);
}, 100);
正在阅读 the documentation Zopim(a.k.a Zendesk Chat):
API calls must be inserted after the Live Chat Script and wrapped within $zopim(function() { ... })
所以我在 HTML 的 head
部分有一个 Zopim 脚本:
<script>/*<![CDATA[*/window.zEmbed||function(e,t){ ... }("https://...);
/*]]>*/</script>
然后我在 HTML 文档的末尾添加了这个:
$zopim(function() {
$zopim.livechat.setName('Logged in name');
$zopim.livechat.setEmail('user@somewhere.com');
});
控制台说:
$zopim is not defined
我想我the instructions 是正确的。我错过了什么?
我找到了更好的解决方案(在提交支持请求后)
zE(function() {
$zopim(function() {
$zopim.livechat.setName("{{\Auth::user()->name}}");
$zopim.livechat.setEmail("{{\Auth::user()->email}}");
});
});
我在 Zendesk Support 中使用了 Zendesk 聊天代码,这就是为什么我需要添加 Ze 功能以使其使用 api。
编辑: 检查
这将循环,等待加载 $zopim 和 $zopim.livechat。 一旦加载完毕,它将停止循环。
var waitForZopim = setInterval(function () {
if (window.$zopim === undefined || window.$zopim.livechat === undefined) {
return;
}
$zopim(function() {
$zopim.livechat.setName("{{\Auth::user()->name}}");
$zopim.livechat.setEmail("{{\Auth::user()->email}}");
});
clearInterval(waitForZopim);
}, 100);