Created
July 2, 2020 13:47
-
-
Save nikkanetiya/907b800fdf889e949456f83433e1d67f to your computer and use it in GitHub Desktop.
How to use freshchat script inside GHL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const freshChatToken = "<token-here>"; // Please update your token here | |
function clientInitFreshChat() { | |
window.fcWidget.init({ | |
token: freshChatToken, | |
host: 'https://wchat.freshchat.com', | |
config: { | |
headerProperty: { | |
hideChatButton: true | |
} | |
} | |
}) | |
// Set this incase you need | |
// window.fcWidget.setExternalId(userData.id) | |
// window.fcWidget.user.setFirstName(userData.name) | |
// window.fcWidget.user.setEmail(userData.email) | |
} | |
function clientFreshchatInitialize(i: any, t: any) { | |
var e | |
i.getElementById(t) | |
? initFreshChat() | |
: (((e = i.createElement('script')).id = t), | |
(e.async = !0), | |
(e.src = 'https://wchat.freshchat.com/js/widget.js'), | |
(e.onload = clientInitFreshChat), | |
i.head.appendChild(e)) | |
} | |
clientFreshchatInitialize(document, 'freshchat-js-sdk') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment