Launch an experience from code

Who can use this feature?

Use the Totango startTour method to manually trigger an experience* to start from anywhere within your app. 

*This article applies to any experience except checklists. Refer to the launchWidget method to launch checklist experiences from code.

We recommend using the startTour method to customize the delivery method of an experience beyond what is capable with url rules. Here are some common use cases we've seen the startTour method used for:

  1. Trigger an experience when a user clicks a button within your app.
  2. Trigger a when a user completes a certain action like inviting their third team member.
  3. Trigger an experience when a user opens a pop up that doesn't change the URL of your app.

Calling the startTour method is simple. Here's an example of a typical call:

totango.startTour('<experienceID>');

Here's an example of how you could use this method to launch an announcement when a user clicks a button on your site:

<button onclick="totango.startTour('261371373929');">
Launch Experience
</button>

Overriding view history

By default, the startTour method first checks that the current user has not viewed the experience more times than its specified view limit (which can be set in delivery rules) or completed the experience. If both conditions are satisfied, then the experience will be delivered and appear immediately for the user.

If you'd like to override a user's view history so that the experience appears no matter what, you can pass an optional second argument to the method like so:

 totango.startTour('1a2b3c4d5e6f', false) 

Overriding user segmentation

By default, the startTour method will first check that the current user is a member of the segments associated with the experience (which can be set in delivery rules). If the user satisfies one of the associated segments, then the experience will be delivered and appear immediately for the user.

If you'd like to override the user segmentation settings so that the experience appears no matter what, you can pass an optional third argument to the method like so:

 totango.startTour('1a2b3c4d5e6f', true, false) 

Calling the startTour method

The startTour method can be called from anywhere within your app that the code snippet has been installed in. You can copy and paste this function call from the manual delivery options during the experience build process or from the experience page on the In-App dashboard.

The method takes three arguments:

  • id: A unique identifier for the experience being started (required, string).
  • includeViewRules: Whether or not a user's view history should be taken into account before delivering the experience (optional, Boolean, defaults to True).
  • includeSegmentation: Whether or not a user's segments should be taken into account before delivering the experience (optional, Boolean, defaults to True).

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request