GoHighLevel Integration

Learn how to install Gleap in GoHighLevel.

Install the Gleap code snippet

Open your agency account which manages all sub-accounts and navigate to Settings and then to Company.

Now locate "Custom Javascript" and paste in the code snippet below. Please make sure to replace YOUR_SDK_KEY_GOES_HERE with your SDK key.

The script below also identifies your customers with Gleap.identify().

<script>
const GLEAP_SDK_KEY = "YOUR_SDK_KEY_GOES_HERE";

!function(Gleap,t,i){if(!(Gleap=window.Gleap=window.Gleap||[]).invoked){for(window.GleapActions=[],Gleap.invoked=!0,Gleap.methods=["identify","setEnvironment","setTags","attachCustomData","setCustomData","removeCustomData","clearCustomData","registerCustomAction","trackEvent","setUseCookies","log","preFillForm","showSurvey","sendSilentCrashReport","startFeedbackFlow","startBot","setAppBuildNumber","setAppVersionCode","setApiUrl","setFrameUrl","isOpened","open","close","on","setLanguage","setOfflineMode","startClassicForm","initialize","disableConsoleLogOverwrite","logEvent","hide","enableShortcuts","showFeedbackButton","destroy","getIdentity","isUserIdentified","clearIdentity","openConversations","openConversation","openHelpCenterCollection","openHelpCenterArticle","openHelpCenter","searchHelpCenter","openNewsArticle","openChecklists","startChecklist","openNews","openFeatureRequests","isLiveMode"],Gleap.f=function(e){return function(){var t=Array.prototype.slice.call(arguments);window.GleapActions.push({e:e,a:t})}},t=0;t<Gleap.methods.length;t++)Gleap[i=Gleap.methods[t]]=Gleap.f(i);Gleap.load=function(){var t=document.getElementsByTagName("head")[0],i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src="https://sdk.gleap.io/latest/index.js",t.appendChild(i)},Gleap.load(),
    Gleap.initialize(GLEAP_SDK_KEY)
}}();

setTimeout(() => {
try {
    if (window.location.href.match("/location/")) {
        const user = eval(atob("ZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiI2FwcCIpLl9fdnVlX18uJHN0b3JlLmdldHRlcnNbJ3VzZXIvZ2V0J10="));
        let companyName = null;
        let companyId = null;

        try {
            if (document.querySelector(".hl_switcher-loc-name")) {
                companyName = document.querySelector(".hl_switcher-loc-name").textContent;
            }
            const url = window.location.href;
            const company_id = url.split("location/")[1].split("/")[0];
            if (company_id && typeof company_id === "string" && company_id.length > 0) {
                companyId = company_id;
            } 
        } catch (error) {
            console.log("Gleap failed getting company informations", error);
        }

        if (user?.id) { 
                Gleap.identify(user.id, {
                name: user.name,
                email: user.email,
                phone: user.phone,
                ...(companyId && { companyId }),
                ...(companyName && { companyName }),
            })
        }
    }
} catch (error) {
    console.log("Error in Gleap integration", error);
}
}, 5000);
</script>
Did this answer your question?
😞
😐
😁