Chat Widget Routing


Your support needs grow with the size of your website. People browsing your shop have different questions than those checking your documentation, international visitors prefer support in their own language, and you might want to use a different approach mode depending on whether your Webvisitors are using a desktop or a mobile browser.

Our **Chat Widget Routers** make the handling of all these scenarios a breeze. You can easily configure rules that select different Chat Widgets depending on the information we have about your Webvisitors: the section of the website they are on when starting a chat, which country they are from, which language they prefer in their browsers, etc. Managing individual chat setups has never been easier.

Chat Widget Routers are available starting with our Business product. Upgrade here.
Topic Description
Configuration How to create and configure Chat Widget routers
Integration How to add configured Chat Widget routers to your website.
Sample Widget Routers Typical examples when using Chat Widget routers is a best-practise - and how to set them up accordingly.


Starting with our Business product you can easily create Chat Widget routers. In your Dashboard, go to "Widget Routers":

Click "Add Widget Router" to create your first Widget Router:

A new Widget Router requires at least a name. It's enabled by default and has the default Chat Widget selected, but since using a Widget Router without a rule set wouldn't be different from using a regular Chat Widget, let's add our first rule set:

We created a new rule set and edited its first rule, which translated to plain language now reads: this rule matches if the Url the Webvisitor is visiting when starting the chat contains the string "shop", between slashes. If the rule set matches, it will select a different widget than the default, in this case the "Active Sales" widget. We could even override some of the "Active Sales" widget's settings if we wanted to.

Once we click "Create Widget Router", we are back to the Widget Router overview, where our newly created router now appears, showing its numbers of rule sets and its current status:

This simple Widget Router already allows us to use a different Chat Widget for Webvisitors that start a chat from our webshop, thus connecting them to the support staff best-suited to answer their questions. You can now create more rule sets for this Widget Router, or create more routers.

Multiple simple routers vs. few complex routers

Whether you want to create multiple simple Widget Routers with simple rule sets or a few complex Widget Routers with many elaborate rule sets is mostly a matter of taste.

Using few complex Widget Routers allows you to manage your Chat Widgets from few configuration items, which are also faster to integrate. But overly complex routers with many rulesets can become hard to understand, which may lead to unwanted behavior.

Multiple simple Widget Routers require more integration work up front since each router has to be integrated manually into your website (see integration section below). Once integrated, however, they can be easier to understand and maintain.

**Please note:** there can be only one Widget Router per HTML page, so if you use multiple Widget Routers you have to ensure that (only) they are loaded at the correct locations.

More on rule sets

A Widget Router can contain many rule sets. Each rule set has to define the Chat widget it will use if **all** of its rules match - or, as a special case, that no widget at all should be displayed.

If a Widget Router has multiple rule sets, these will be evaluated in a 'short-circuit' logic: the rule sets (i.e. its rules) will be tested sequentially, and the first rule set whose rules **all** match 'wins' and its Chat Widget will be selected.

In addition to selecting a Chat Widget, a rule set can also be configured to override the following configuration settings of the selected Chat Widget:

Setting Description
Approach mode Changes the widget's default approach mode, e.g. enforce Webvisitor registration if current rule set matches
Offline mode Changes the widget's default offline mode, e.g. enable Chat Butler if current rule set matches
Button position Changes the widget's default button position, e.g. show it on the left side if current rule set matches
More on single rules

Each rule set can consist of multiple rules but must contain at least one. If you create more than one rule for a rule set, all of them have to match in order for the rule set to match. Currently you can create the following rules:

Filter Operator Value Description
URL is free text input Matches if the Webvisitor's URL is exactly the string you provided
URL contains regex free text input Matches if the Webvisitor's URL contains the regular expression you provided
User Agent contains regex free text input Matches if the Webvisitor's user agent string contains the regular expression you provided
Geolocation is value from drop-down Matches if the Webvisitor's IP address resolves to the selected country (or continent)
Language is value from drop-down Matches if the Webvisitor's derived language preference equals the selected language
Device is value from drop-down Matches if the Webvisitor's browser falls into the selected category (desktop vs. mobile)

**Please note:** while we do some basic syntactic validation for each rule (e.g. we check if the provided string is a valid regular expression), you are responsible for building semantically valid rule sets where the single rules do not exclude each other.

For example, if you create a rule set with two rules where the first one requires the Webvisitor's country to be 'Germany' while the second rule only matches if the country is 'Austria', the rule set as a whole can never match. It is your responsibility to create rule sets that can be matched - otherwise your Widget Router will always fall back to the configured default widget.

We will show more prototypical Widget Router rule set configurations in the example section below.


Integrating a Widget Router into your website works the same way as integrating a regular Chat Widget: you simply have to add one line to your website's HTML templates, which will then load the Widget Router's Javascript code.

For each of your Widget Routers we provide the respective HTML snippet, ready for you to copy and integrate it yourself or to send it to your technical staff. In the Widget Router overview, edit the Widget Router you want to integrate:

Switch to the "Integration" tab, where you will find the HTML snippet code, ready to be copied and pasted:

Integrating the code yourself

Paste the code into the bottom of your website, just before the closing </body> tag. Save your modified website and upload it to your web server. Congratulations, you are done!

We strongly advise you to place the script within the body tag of the website. If you include the script in the header of the page, it will not work properly on Internet Explorer due to undefined loading behavior of the chat client.
Due the Javascript sandbox restriction it is not possible to view the file via the local file:// protocol and run the script. If you want to test the widget on a local file, you need to run it using a local webserver.
Sending the code to your technical staff

Instead of copying the code, click the "Let my Programmer do it" button:

You now see a pre-written message containing all the necessary information for your technical staff to integrate the Widget Router. Just provide the e-mail address we should send this message to:

Your technical staff will then receive the following e-mail:

Sample Widget Routers

We have compiled some sample Widget Routers to give you an idea of when to use them and how the configuration can look in these cases.

Load Chat Widgets based on Webvisitor language

You have a website with an international target audience, and your staff is able to offer customer support in three different languages: German, Spanish and English.

First create a localized Chat Widget for each language like the one below:

Then create a Widget Router with the following configuration:

This Widget Router will do the following: first it checks if the Webvisitor's browser language settings indicate support for any German locale. If yes, it will load the Chat Widget "Kundenservice auf Deutsch".

Then it checks if the Webvisitor's browser language settings indicate support for any Spanish locale. If yes, it will load the Chat Widget "Asistencia en espaƱol". In all other cases it will load the default Chat Widget "Support in English", as fallback solution.

Things to consider when matching for languages

Most web browsers let you configure more than one language. Our language-based rules only try to match the primary language. Also regional variations are currently ignored, so a rule for Portuguese matches Brazilian and European Portuguese.

When doing language matching it is also good practise to have your default widget in a language you trust the majority of your Webvisitors can understand. This way, if none of the more specific language rules match, you will safely fall back to your "main" language version.

Override Chat Widget configurations based on website URL

You want to use a different approach mode depending on which section of your webshop your Webvisitors are browsing. In general you want to proactively initiate a chat after a certain timeout and see if you can assist your potential customers - only for the FAQ section you want to leave it to your Webvisitors to initiate a chat session.

You configure your default Chat Widget to use an proactive approach mode:

Then, to use the same widget with a different approach mode when the Webvisitor browses your FAQs, create a Widget Router with the following configuration:

This Widget Router checks if the Webvisitor is currently visiting your FAQ section. If yes, it will load the "My Webshop" widget but set it to "Normal" approach mode.

In all other cases it will also load the "My Webshop" widget but keep its default approach mode - meaning it will proactively start a chat after 10 seconds on all non-FAQ pages of your webshop.

Load different Chat Widgets depending on geolocation

Due to different legal requirements, you want to use Chat Widgets with different privacy settings, depending on your Webvisitors geolocation.

You configure one Chat Widget to have a more restrictive privacy mode:

Then create a Widget Router with the following configuration:

This Widget Router checks if your current Webvisitor is based in Europe. If yes, it will load the "EU privacy" widget, with its more restrictive settings. In all other cases it will load the "Standard" widget.