I have tried adding the chat script on .phtml of the custom extension which I have created for integrating my own live chat. But the libraries are showing undefined when the chat plugin loads the minified js.
Please let me know if there is any specific way to define libraries in Magento 2 which are being used in chat js as the same plugin is working on other platforms.

<script type = "text/javascript" >
   function initSupportScript() {
       var t = document.getElementsByTagName("head")[0],
           e = document.createElement("script");
       e.type = "text/javascript", e.src = 'https://www.example.com/plugins/js/chatcustomersupport.v3.min.js', e.onload = initChat, t.appendChild(e)
if ("undefined" == typeof jQuery) {
   var headTag = document.getElementsByTagName("head")[0],
       jqTag = document.createElement("script");
   jqTag.type = "text/javascript", jqTag.src = "https://www.example.com/static/assets/global/plugins/jquery.min.js", jqTag.onload = initSupportScript, headTag.appendChild(jqTag)
} else initSupportScript();

/* Initialize Chat */
function initChat() {
       customercode: 'xxxxxxxxxxxxxxxxxx', // encrypted customer code 
       key: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // partner support key
       iv: 'xxxxxxxxxxxxxxxxx', // pseudo random string in hex format
       label: 'Live Support',
       context: 'xxxxxxxxxxxxxxxx',
       success: function() {
           // your callback here (optional)
       error: function(e) {


  • Can you add your error here ? Jan 25, 2019 at 6:43
  • error in console - "TypeError: timesync is undefined" - | but timesync minified version is already added in chat js
    – Genio
    Jan 25, 2019 at 6:55

1 Answer 1


You can refer extension for crisp chate here: https://github.com/magepow/magento-2-crisp-chat

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.