Skip to content

Instantly share code, notes, and snippets.

@vanessaramirez
Created October 29, 2019 22:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanessaramirez/837bbda0d014798c4a1f6810d26f327b to your computer and use it in GitHub Desktop.
Save vanessaramirez/837bbda0d014798c4a1f6810d26f327b 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');
var tags = [];
tags.push('Silo-id:' + basicInfo.data('silo-id'));
if ($.cookie('destination') === 'Carnation') {
tags.push('canary');
}
window.zESettings = {
webWidget: {
helpCenter: {
searchPlaceholder: {
'*': 'Search for a solution',
},
},
authenticate: {
jwtFn: function(callback) {
callback(basicInfo.data('widget-jwt'));
},
chat: {
jwtFn: function(callback) {
callback(basicInfo.data('visitor-auth-jwt'));
},
},
},
chat: {
tags: tags,
},
},
};
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'),
});
});
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment