Attempts to load the chat widget on-demand
we have a requirement to load the chat widget on-demand. this is required as user identifier is loaded asynchronously. so we need to load the chat widget only after customer data available in website.
we have modified idex.html to load the widget.
we have a requirement to load the chat widget on-demand. this is required as user identifier is loaded asynchronously. so we need to load the chat widget only after customer data available in website.
we have modified idex.html to load the widget.
<!DOCTYPE html> <title>Pega test page</title> <head> <script src='https://xxxxxxxxxxxxxxx/prweb/app/default/?pyActivity=pzIncludeMashupScripts'></script> <script src="domWrapper.js"></script> <script src='PegaHelperExtension.js'></script> <script src='PegaHelper.js'></script> <link rel="stylesheet" type="text/css" href="PegaStyles.css?nocache=20200611T145831.601GMT"> <script> // this will not be called until the button is clicked function loadChat() { window.setContactId(12345) window.chat.init() window.chat.enable(true) } </script> <style> .content { font-family: Arial, Helvetica, sans-serif; max-width: 1024px; margin: 0 auto; } </style> </head> <body> <div class="content"> <h1>2) Load chat widget on demand - not working</h1> <p> This is a non-working version that attempts to load the chat widget on-demand, which is what the application will need to do after the user identifier is loaded asynchronously. </p> <p><strong>Click Load chat to load the chat widget:</strong><br /> <a href="#" onclick="loadChat()">Load chat</a></p> </div> </body> </html>
please suggest how can we do it.