Skip to content

Include the widget on the client's website

To include the widget on the client's website in the production environment, a Javascript script is placed that will be responsible for loading all the elements necessary for the widget to work. Next is the script that should be included:

    <script>
        (function (window, document, scriptTagName, globalName, scriptAddress, scriptElement, otherScriptElement) {
        window['ChatLynn-Widget'] = globalName;
        window[globalName] = window[globalName] || function () {
        (window[globalName].q = window[globalName].q || []).push(arguments);
        window[globalName].s = scriptAddress;
        };
        scriptElement = document.createElement(scriptTagName);
        otherScriptElement = document.getElementsByTagName(scriptTagName)[0];
        scriptElement.async = 1;
        scriptElement.src = scriptAddress;
        otherScriptElement.parentNode.insertBefore(scriptElement, otherScriptElement);
        })(window, document, 'script', 'mw', 'XXXXXX');
        mw('create', '', { }, {});
    </script>

The XXXXX must be replaced with the URL of the widget corresponding to your tenant. If it is necessary to pass parameters in the interaction such as additional data or not to open the form, you can use the following sentence at the end of the Script:

mw('create', '', { }, {});

mw(<1st parámetro>, <2nd parámetro>,<3rd parámetro> , <4th parámetro>)

1st parameter: reserved 2nd parameter: criterion variable 3rd parameter: userdata, for example, the user's RUT or department who is logged in on the client's page. 4th parameter: additional configurations

Ejemplo:
mw('create', 'uid', { page_name: Consultas }, {});