Userflow.js installation in GoHighLevel

You can install Userflow.js in your GoHighLevel account, which will enable you to build flows, checklist, launchers and surveys for your users.

Follow these simple steps:

  1. Sign into Userflow.
  2. Go to Settings → Environments.
  3. Note down your Userflow.js Token (you’ll need it in a later step). Hint: It starts with ct_.
  4. Sign into your GoHighLevel agency account.
  5. Go to Settings → Agency Settings.
  6. In the Custom Javascript field, paste the code below (make sure to replace USERFLOW_TOKEN with the real token you noted down in step 3).
<script>
  !function(){var e="undefined"==typeof window?{}:window,r=e.userflow;if(!r){var t="https://js.userflow.com/",n=null;r=e.userflow={_stubbed:!0,load:function(){return n||(n=new Promise((function(r,o){var s=document.createElement("script");s.async=!0;var a=e.USERFLOWJS_ENV_VARS||{};"es2020"===(a.USERFLOWJS_BROWSER_TARGET||function(e){for(var r=[[/Edg\//,/Edg\/(\d+)/,80],[/OPR\//,/OPR\/(\d+)/,67],[/Chrome\//,/Chrome\/(\d+)/,80],[/CriOS\//,/CriOS\/(\d+)/,100],[/Safari\//,/Version\/(\d+)/,14],[/Firefox\//,/Firefox\/(\d+)/,74]],t=0;t<r.length;t++){var n=r[t],o=n[0],s=n[1],a=n[2];if(e.match(o)){var l=e.match(new RegExp(s));if(l&&parseInt(l[1],10)>=a)return"es2020";break}}return"legacy"}(navigator.userAgent))?(s.type="module",s.src=a.USERFLOWJS_ES2020_URL||t+"es2020/userflow.js"):s.src=a.USERFLOWJS_LEGACY_URL||t+"legacy/userflow.js",s.onload=function(){r()},s.onerror=function(){document.head.removeChild(s),n=null;var e=new Error("Could not load Userflow.js");console.error(e.message),o(e)},document.head.appendChild(s)}))),n}};var o=e.USERFLOWJS_QUEUE=e.USERFLOWJS_QUEUE||[],s=function(e){r[e]=function(){var t=Array.prototype.slice.call(arguments);r.load(),o.push([e,null,t])}},a=function(e){r[e]=function(){var t,n=Array.prototype.slice.call(arguments);r.load();var s=new Promise((function(e,r){t={resolve:e,reject:r}}));return o.push([e,t,n]),s}},l=function(e,t){r[e]=function(){return t}};s("_setTargetEnv"),s("closeResourceCenter"),s("disableEvalJs"),s("init"),s("off"),s("on"),s("prepareAudio"),s("registerCustomInput"),s("remount"),s("reset"),s("setBaseZIndex"),s("setCustomInputSelector"),s("setCustomNavigate"),s("setCustomScrollIntoView"),s("setInferenceAttributeFilter"),s("setInferenceAttributeNames"),s("setInferenceClassNameFilter"),s("setResourceCenterLauncherHidden"),s("setScrollPadding"),s("setServerEndpoint"),s("setShadowDomEnabled"),s("setPageTrackingDisabled"),s("setUrlFilter"),s("openResourceCenter"),s("toggleResourceCenter"),a("endAll"),a("endAllFlows"),a("endChecklist"),a("group"),a("identify"),a("identifyAnonymous"),a("start"),a("startFlow"),a("startWalk"),a("track"),a("updateGroup"),a("updateUser"),l("getResourceCenterState",null),l("isIdentified",!1)}}();

  userflow.init('USERFLOW_TOKEN')
  userflow.identify('{{user.id}}', {
    name: '{{user.name}}',
    email: '{{user.email}}',
    signed_up_at: new Date({{user.data.date_added.seconds}} * 1000).toISOString()
  })
</script>

IMPORTANT: Make sure to replace USERFLOW_TOKEN with the Userflow.js Token you find in Userflow under Settings -> Environments .

How it works

The snippet above is our standard Userflow.js snippet, but using template variables provided by GoHighLevel, such as {{user.id}} to dynamically get the current user’s ID.

Extra custom attributes

You can pass whatever custom attributes you want to Userflow in the userflow.identify() call.

GoHighLevel exposes many template variables besides the ID, name, email and signed up at fields we used above. Feel free to add your own, such as permissions.

One tip to see which fields are available is to add this piece of code to your Custom JavaScript field:

<script>
  console.log('^^^^^ user object ^^^^^', '{{log user}}')
</script>

Then, in a tab running GoHighLevel as one of your users, do this:

  1. Open DevTools (F12 on your keyboard)
  2. Reload the page
  3. Look in the Console tab for the ^^^^^ user object ^^^^^ text. The line above that should be the complete user object. You can expand it to see which other fields it contains.

Got questions? We're here for you!

The best way to get help is to
We usually reply within 5 minutes
You can also send an email to support@userflow.com
We usually reply within a few hours