How to set the bot avatars dynamically

Sometimes you’d like the same bot to have different avatar images on the different pages of your website (or just different websites).

This is possible with explicit initialization.

For example, if we want to override the bot avatars on page 1 but on page 2 keep the settings as is

On page 1 (custom images), embed the code

<script type="text/javascript">
if (!Array.isArray(window.qbOptions)) {
    window.qbOptions = []
}
window.qbOptions.push({
    "use":"sadfasdfasdfas/wj0M8mVgeJrRW4qY",
    "avatarImage": "https://www.w3schools.com/howto/img_avatar2.png",
    "stickyAvatarPopup": {
        "image": "https://www.w3schools.com/howto/img_avatar2.png"
     }
});
</script>
<script type="text/javascript" src="https://static.botsrv.com/website/js/widget2.ea14eec4.js" integrity="sha384-eIQOpcMrVK2La47/uGhqpJMnpRZ4rtYQpRgr1/EbeF2HLFSPGoMsegUKf2xJUcuP" crossorigin="anonymous" async defer></script>

Please note that avatarImage and stickyAvatarPopup parameters are passed.

On page 2 (no custom images), embed the code

<script type="text/javascript">
if (!Array.isArray(window.qbOptions)) {
    window.qbOptions = []
}
window.qbOptions.push({
    "use":"sadfasdfasdfas/wj0M8mVgeJrRW4qY"
});
</script>
<script type="text/javascript" src="https://static.botsrv.com/website/js/widget2.ea14eec4.js" integrity="sha384-eIQOpcMrVK2La47/uGhqpJMnpRZ4rtYQpRgr1/EbeF2HLFSPGoMsegUKf2xJUcuP" crossorigin="anonymous" async defer></script>

Edit this page