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.
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.
The panel shows this one line version. It is fine when you only call SDK methods after the script has loaded, for example inside an onload callback.
With this version, window.userGuiding and window.userGuidingLayer do not exist until the script runs. Create the layer yourself before you push callbacks to it:
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: