> For the complete documentation index, see [llms.txt](https://docs.userlane.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.userlane.com/developer-reference/start-a-guide-with-a-javascript-command.md).

# Start a Guide with a JavaScript command

Start or start-once a Guide from a custom trigger using the start command.

## About the start command

The `start` command launches a Guide from a custom trigger in the application, for example a button. This lets the Guide fit the application's own user experience.

{% hint style="info" %}
The command plays the Guide directly. It does not take display rules or audience targeting into account.
{% endhint %}

Look up the Guide ID in the Userlane Portal, then insert it into one of the commands below.

## Start a Guide

```javascript
// replace 12345 with the Guide ID
Userlane('start', '12345');
```

Calling the command also fires the `onStart` event. See [Hooking into event callbacks](/developer-reference/hooking-into-event-callbacks.md).

## Start a Guide only once per user

```javascript
// replace 12345 with the Guide ID
Userlane('startOnce', '12345');
```

This works only where a specific user ID is passed via the snippet. If that user ID changes, the Guide appears again. If a user leaves the Guide part way through, it reappears until the Guide has been completed.

## Start a Guide at a specific step

**Important:** the step index starts at 0. That is different from the step number shown in the Editor and the Portal, which starts at 1. To start a Guide at step 11, pass the index 10.

```javascript
// replace 12345 with the Guide ID
// replace 4 with the index of the step
Userlane('start', '12345', 4);
```

{% hint style="info" %}
**Good to know**

While signed in to the Userlane Portal, the start command works even on a Guide set to private, which makes it a convenient way to test a trigger. End users do not see a Guide that is set to private.
{% endhint %}

## Relevant articles

{% content-ref url="/pages/QoC1TgEC9ALRtbtaX7F9" %}
[Hooking into event callbacks](/developer-reference/hooking-into-event-callbacks.md)
{% endcontent-ref %}

{% content-ref url="/pages/JaoydeD5UPCYFS9NuupA" %}
[Quick reference of commands](/developer-reference/quick-reference-of-commands.md)
{% endcontent-ref %}

{% content-ref url="/pages/9LSBBfW7D6q4LDf7Zi6F" %}
[Implement a command to open the Assistant](/developer-reference/implement-a-command-to-open-the-assistant.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.userlane.com/developer-reference/start-a-guide-with-a-javascript-command.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
