Step 1 - Generate the Master CDN link
MasterCDN is our script generating Tool. Using the following guide you should be able to generate the code relevant to the respective client.
Guide -https://commversioncom.freshdesk.com/a/solutions/articles/88000042212
Step 2 - Edit the below script
From the following piece of script, edit the highlighted bit and add the code from Step1 here.
Note: Only copy the CDN code within the "___"
Example: script.src = "https://cht-srvc.net/api/lc.js?client=nhfs_new_homes_for_sale";
<script type="application/javascript">
function loadCvChatScript() {
var script = document.createElement("script");
script.src = "Master CDN SCRIPT";
script.async = true;
document.body.appendChild(script);
console.log("LiveChat triggered.");
}
function initializeLiveChat() {
console.log("LiveChat initialization started", typeof LiveChatWidget !== "undefined");
var retryCount = 0;
var maxRetries = 7;
var retryInterval = 300;
function checkAndInitializeWidget() {
if (typeof LiveChatWidget !== "undefined" && !(window && window.__lc_inited === true)) {
LiveChatWidget.init();
console.log("LiveChat script initialized in " + retryCount + " retries");
} else {
console.log("LiveChat script not ready, retrying in " + retryInterval + "ms");
if (retryCount < maxRetries) {
retryCount++;
setTimeout(checkAndInitializeWidget, retryInterval);
} else {
console.error("Failed to initialize LiveChat script");
}
}
}
checkAndInitializeWidget();
}
window.__lc = window.__lc || {};
Object.assign(window.__lc, {
asyncInit: true,
});
loadCvChatScript();
setTimeout(function () {
initializeLiveChat();
}, 300);
</script>
Step 3 - Copy & Paste the Page Load Script
Use the above script to add it to either:
-Client's GTM - https://scribehow.com/shared/How_To_or_GTM_Setup_247__A7svuo56ROuCNjHvwTnOxQ
-Hardcode at the backend - ( Client's developer to action)
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article