Script Lifecycle
These methods control the lifecycle of the Guides and Surveys script and its UI elements. They are called directly on the window.USETIFUL object rather than on a sub-namespace like user or tour.
reinitialize()
Re-evaluates all triggers after a page change. Call this method in single-page applications (SPAs) after navigation events to ensure Guides and Surveys detects the new page context and activates the appropriate content.
removeContent()
Removes all Guides and Surveys UI elements from the DOM, including active tours, checklists, surveys, and banners. The script remains loaded and triggers remain active, so content may reappear if a trigger condition is met.
To remove both UI elements and triggers, call removeTriggers() after removeContent(), or use deactivateScript() to remove everything at once.
removeTriggers()
Removes all active event listeners and triggers managed by Guides and Surveys. After calling this method, no new content will be triggered. Any content already displayed remains in the DOM.
To fully clear the page, call removeContent() before removeTriggers(), or use deactivateScript().
deactivateScript()
Completely deactivates the Guides and Surveys script. This removes all UI elements from the DOM, clears all event listeners and triggers, and unloads the script. After calling this method, no Guides and Surveys functionality is available until the page is reloaded.
Use this method when you need to fully disable Guides and Surveys on the current page, for example in response to a user action or an application state that requires a clean page.