All Collections
For Developers
Common questions
How can I trigger a Guide using JavaScript?
How can I trigger a Guide using JavaScript?

You can invoke a Guide programmatically by using JavaScript.

Gabriel avatar
Written by Gabriel
Updated over a week ago

You can easily trigger a Guide using the following method from our JavaScript API.



You can find the guideId  on your Guide settings, under the Guide's title.

In the example below, we're triggering a Guide through an HTML button.

<button onclick="window.userGuiding.previewGuide(guideId)">Play my Guide!</button>

If you want the Guide to be triggered only if the targeting conditions are met, set checkHistory as false. If true, it tries to meet the targeting and segmentation conditions. The default value is false.

userGuiding.previewGuide(guideId, { 
  checkHistory: true,

Finally, you can also start a Guide from a specific step. The default value is 0 (first step).

userGuiding.previewGuide(guideId, { 
  initialStep: 2,
Did this answer your question?