Skip to content

Installation

The SDK ships as a container script that UserGuiding hosts for you. Once it loads, it exposes the window.userGuiding object with every method in this section.

Copy your container ID from Settings > Containers in the panel. Then add one of the snippets below to the <head> of every page where UserGuiding should run.

The inline snippet loads the script asynchronously and creates a small stub, so any call you make before the script finishes loading is queued and replayed once it is ready.

<script>
(function(g,u,i,d,e,s){g[e]=g[e]||[];var f=u.getElementsByTagName(i)[0];var k=u.createElement(i);k.async=true;k.src='https://static.userguiding.com/media/user-guiding-'+s+'-embedded.js';f.parentNode.insertBefore(k,f);if(g[d])return;var ug=g[d]={q:[]};ug.c=function(n){return function(){ug.q.push([n,arguments])};};var m=['previewGuide','finishPreview','track','identify','page','hideChecklist','launchChecklist'];for(var j=0;j<m.length;j+=1){ug[m[j]]=ug.c(m[j]);}})(window,document,'script','userGuiding','userGuidingLayer','YOUR_CONTAINER_ID');
</script>

The m array lists the methods that are safe to call early. Add any other method name from this reference to the array if you need to call it before the script loads.

Queued calls from the inline snippet run automatically. For anything else, wait for the SDK to load. Push an onload callback to userGuidingLayer:

window.userGuidingLayer = window.userGuidingLayer || []
window.userGuidingLayer.push({
event: 'onload',
fn: () => {
window.userGuiding.launchChecklist(1234)
},
})

Or assign a single global function:

window.onUserGuidingLoad = () => {
window.userGuiding.launchChecklist(1234)
}

Most methods also wait for identification to finish. If user identification is enabled for your project, call identify first. Queued calls made before identification completes are held until it does. See Callbacks for every event you can subscribe to.

The SDK watches the page URL and records a page view each time it changes, so client side routing in React, Vue, Angular and similar frameworks works without extra code.

If you would rather decide when a page view happens, turn off automatic capture before the script loads and call page() yourself on the first load and on every route change:

window.userGuidingSettings = {
disablePageViewAutoCapture: true,
}

To stop UserGuiding from rendering anything on a specific page, set disabled before the script loads:

window.userGuidingSettings = {
disabled: true,
}
window.userGuidingSettingsobject

Optional global settings. Set them before the container script loads.

Show properties
disablePageViewAutoCapturebooleandefault: false

Stops automatic page view tracking. You must then call userGuiding.page() on every page change.

disabledbooleandefault: false

Prevents the SDK from rendering any content on the page.

If your app sends a Content-Security-Policy header, allow the UserGuiding hosts first. See Content Security Policy.