Advice and answers from the UserGuiding Team
Users
Engagement
Settings
Guides
Learn how to utilize the UserGuiding's JavaScript API to start or finish guides

Start a Guide

Triggers a specific Guide by its ID, starting it for the current user. If another Guide is currently playing, it will be interrupted, and the requested guide will start.


Type Definition

type previewGuide = (
guideId: number,
options?: {
checkHistory?: boolean,
initialStep?: number,
}
) => void


Optional parameters:

  • initialStep (number) – The step number to start the Guide from (0-indexed). Default is 0 , starts from the first step.
  • checkHistory (boolean) – If false, the guide will ignore whether it was shown before and only check basic targeting conditions. If true, it will enforce all guide conditions (targeting, appearance frequency, segmentation) as if normally triggered. Default is false.


Examples

Trigger a Guide with default options


userGuiding.previewGuide(1234)


Start a Guide from the 2nd step only when user meets the segmentation and appearance conditions


userGuiding.previewGuide(
1234, {
initialStep: 2,
  checkHistory: true
}
)



Finish the Guide

Immediately stops any Guide that is currently being previewed (i.e., currently active guide). This will close the guide UI on the page.


Type Definition

type finishPreview = () => void


Example

Stop any active guide

userGuiding.finishPreview();


Proceed to Next Guide Step

Immediately stops any Guide that is currently being previewed (i.e., currently active guide). This will close the guide UI on the page.


Type Definition

type goToNextGuideStep = (stepIndex?: number) => void


Optional parameter:

  • stepIndex (number) – The step number to go to (0-indexed). Default is current step + 1

Examples

Go to next step

userGuiding.goToNextGuideStep();


Go to 5th step


userGuiding.goToNextGuideStep(4);
Did this answer your question?