How to add javascript / embedd live chat on Mobile app

Hi, how do I embedd this snippet on one of my mobile pages to enable live chat? I tried to add a Javascipt element to a onready action but it does not seem to work? The intructions from freshchat are to:

Paste this code snippet before </BODY> 

  function initFreshChat() {


      token: "XXX",

      host: ""



  function initialize(i,t){var e;i.getElementById(t)?initFreshChat():((e=i.createElement("script")).id=t,e.async=!0,e.src="",e.onload=initFreshChat,i.head.appendChild(e))}function initiateCall(){initialize(document,"Freshdesk Messaging-js-sdk")}window.addEventListener?window.addEventListener("load",initiateCall,!1):window.attachEvent("load",initiateCall,!1);

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.