Make chat widget available for certain ORG tags

Answered

5 Comments

  • Fernando Duarte
    Comment actions Permalink

    Here's a script that you can use on your website to show the widget on selected customers only

    <script type="text/javascript">

    if(HelpCenter.user.tags.indexOf('vip_chat') > -1)
    { //Checks to see if a certain tag is associated with the logged-in user
    console.log('I have the tag');
    window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s= d.createElement(s),e=d.getElementsByTagName(s)[0];
    z.set=function(o){z.set. _.push(o)};
    z._=[];z.set._=[];
    $.async=!0;$.setAttribute('charset','utf-8');
    $.src='//v2.zopim.com/?ACCOUNTKEY';
    z.t=+new Date;
    $. type='text/javascript';
    e.parentNode.insertBefore($,e)
    })(document,'script');
    }

    </script>

    0
  • Jacob J Christensen
    Comment actions Permalink

    Hi David,

    If you want to simply suppress the chat feature of the web widget, but leave other options available (if you have them), you could use the following:

    <script type="text/JavaScript">
    window.zESettings = {
    webWidget: {
    chat: {
    suppress: true
    },
    }
    };
    </script>

    If you want to hide the whole widget you can do that too:

    <script>
      zE(function() {
        zE.hide();
      });
    </script>

    If you're using the chat widget (not the web widget) you can hide that too, like this:

    <script>

    $zopim(function() {
    $zopim.livechat.button.hide();
    });

    </script>

    I haven't included the conditions for suppressing/hiding the elements because you appear to have that part covered (also I wouldn't know where to begin with that ;))

    Hope that helps you out.

    0
  • David
    Comment actions Permalink

    Thanks for the suggestion Jacob!

    1
  • Amanda Oka
    Comment actions Permalink

    Hello @fernando,

    Is it possible to include multiple user tags?  Maybe switch out 'if' with a Case?  We're trying to show our chat only to users within certain countries (users are tagged with country code).  Will your example still work?  Or would I need to duplicate this for each tag?

    Also, the Account Key, is that a token or our account domain?

    Thank you,

    Amanda

    0
  • Brett - Community Manager
    Comment actions Permalink

    Hey Amanda,

    It looks like you have a ticket open with our Solutions Consultants team regarding this. If you don't get any assistance here from the community we will continue working with you in the ticket :)

    Cheers!

    0

Please sign in to leave a comment.

Powered by Zendesk