Skip to content

Instantly share code, notes, and snippets.

@vanessaramirez
Created September 18, 2019 14:00
Show Gist options
  • Save vanessaramirez/11f304a69859a304d4b923fdb40004cb to your computer and use it in GitHub Desktop.
Save vanessaramirez/11f304a69859a304d4b923fdb40004cb to your computer and use it in GitHub Desktop.
(function() {
function inIframe() {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
if (!inIframe()) {
var basicInfo = $('#zendesk-web-widget');
window.zESettings = {
authenticate: { jwt: basicInfo.data('widget-jwt') },
webWidget: {
helpCenter: {
searchPlaceholder: {
'*': 'Search for a solution',
},
},
},
};
window.zEmbed ||
(function() {
var queue = [];
window.zEmbed = function() {
queue.push(arguments);
};
window.zE = window.zE || window.zEmbed;
document.zendeskHost = basicInfo.data('zendesk-host');
document.zEQueue = queue;
})();
zE(function() {
zE.identify({
name: basicInfo.data('user-name'),
email: basicInfo.data('user-email'),
organization: basicInfo.data('organization-name'),
});
$zopim(function () {
var siloId = basicInfo.data('silo-id');
$zopim.livechat.addTags('Silo-id:' + siloId);
if ($.cookie('destination') == 'Carnation') {
$zopim.livechat.addTags("canary");
}
$zopim.livechat.authenticate({
jwtFn: function(callback) {
callback(basicInfo.data('visitor-auth-jwt'));
}
});
});
});
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment