Hi team,
I am a javascript developer and I found some issues with your script
1. It is loading synchronously where script tag is placed directly. Because of this the page will show as loading until the chat script is loaded. This can be a problem on slow connections in India. Instead script should be loaded asynchronously.
https://stackoverflow.com/questions/7718935/load-scripts-asynchronously
2. There are too many API calls. Since all these are occuring on initialization, they can be clubbed into a single initialization api to make things faster.