Use the Totango launchWidget
method to manually trigger an experience* to start from anywhere within your app.
*This article applies to checklist experiences. Refer to the startTour
method to launch non-checklist experiences from code.
We recommend using the launchWidget 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 launchWidget method used for:
- Launch a checklist when a user clicks a button within your app.
- Launch a checklist when a user completes a certain action, like inviting their third team member.
- Launch a checklist when a user opens a pop up that doesn't change the url of your app.
Calling the launchWidget
method is simple. Here's an example of a typical call:
totango.launchWidget('<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.launchWidget('261371373929');">
Launch Checklist
</button>
Overriding view history
By default, the launchWidget
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.launchWidget('1a2b3c4d5e6f', false)
Overriding user segmentation
By default, the launchWidget
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.launchWidget('1a2b3c4d5e6f', true, false)
Calling the launchWidget method
The launchWidget
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).