I am using below code to execute live chat code through which I have added a div and chat box is showing which is working fine.
try {
// LIVECHAT
//if (matchMedia('only screen and (min-width: 1025px)').matches)
//{
var __lc = {};
__lc.license = XXXXXX;
(function () {
var lc = document.createElement("script");
lc.type = "text/javascript";
lc.async = true;
lc.src =
("https:" == document.location.protocol ? "https://" : "http://") +
"cdn.livechatinc.com/tracking.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(lc, s);
})();
var LC_API = LC_API || {};
LC_API.open_chat_window = function () {
$(".chatbox").show();
$("#chat-widget-container").show();
};
LC_API.on_chat_window_minimized = function () {
$(".chatbox").show();
$("#chat-widget-container").hide();
};
LC_API.on_chat_window_opened = function () {
$(".chatbox").hide();
$("#chat-widget-container").show();
};
LC_API.on_chat_window_hidden = function () {
$(".chatbox").show();
$("#chat-widget-container").show();
};
//}
} catch (err) {}
$(".openChat").on("click", function (event) {
LC_API.open_chat_window();
return false;
});
But when I go to Google Pagespeed Insights and track the website in mobile https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fwww.rosterelf.com%2F, I am getting the low rankings as its keep saying this.
Time to Interactive 11.9 s
If I comment the above code then my percentage getting higher to above 65.
So can someone guide me how can I optimize this script to solve this issue ?
Thanks