Skip to content

Instantly share code, notes, and snippets.

View luizfaias's full-sized avatar

Luiz Faias Junior luizfaias

View GitHub Profile
@luizfaias
luizfaias / web_widget_chat_dept_status.js
Created February 26, 2020 13:18
Zendesk Web Widget + Chat - shows the widget when a single department is online
<script id="ze-snippet" src="https://static.zdassets.com/ekr/snippet.js?key=YOUR_WEB_WIDGET_KEY_GOES_HERE"> </script>
<script type="text/javascript">
var department_name = 'Sales';
zE('webWidget:on', 'chat:connected', function() {
zE('webWidget', 'updateSettings', {
webWidget: {
chat: {
departments: {
enabled: [department_name],
@luizfaias
luizfaias / hc_add_robots.js
Last active February 28, 2020 14:22
Adds the noindex meta tag to all pages on the Help Center, except the home page
<script type="text/javascript">
//prevents all pages, except the home page, from being indexed by search engines
if(window.location.pathname.match(/\/hc\/(.*)\/([a-z])/)) {
var meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
document.getElementsByTagName('head')[0].appendChild(meta);
}
</script>