Submit Article Requests

Do you have a suggestion for an article you would like to see created?
Feel free to submit this form and add your suggestions to our document board.

Please fill out the contact form below and we will reply as soon as possible.

  • Appcues Certifications & Training
  • Integration Hub
  • Contact Us
  • Docs home
  • Web Experiences
  • Use Cases

Use the JavaScript API to Launch Flows

Learn how to use the JavaScript API to manually trigger Appcues Flows.

Updated at June 18th, 2024

Submit Article Requests

Do you have a suggestion for an article you would like to see created?
Feel free to submit this form and add your suggestions to our document board.

Please fill out the contact form with the details about the help content you'd like to see.

  • Home

  • Installation & Developers

    • Web Experiences

      • Mobile Experiences

        • Workflows

          • Analytics & Data

            • Account Management

              • Best Practices

                • Integrations

                  • System Status

                    Table of Contents

                    Build Guide Step 1: Decide what action in your application will trigger the Appcues flow Step 2: Find the flow ID of the flow you want to show Step 3: Add the Appcues.show() call Step 4: Publish the flow Step 5: Test it out Alternate methods: Using Appcues.track() and Event Triggering Using a permalink

                    Appcues is great at naturally showing content in your application when your users navigate from page to page. But sometimes, you might have a situation that requires a bit more finesse over exactly when to begin showing content. When that happens, making use of Appcues's JavaScript API to manually trigger flows can be a great option! 

                    Build Guide

                    This guide presupposes an active Appcues account with Appcues already installed in your application. If you have yet to install Appcues, check out our Installation Overview. 

                    Let's walk through triggering a flow manually using Appcues.show() from directly within your application's code.

                    Step 1: Decide what action in your application will trigger the Appcues flow

                    In this case, I've added a button in my application that I would like to use to trigger an Appcues flow when a user clicks on it. When clicked, it triggers the function, showMoney.

                    For now, nothing happens when you click it other than logging a message in the console.

                    Step 2: Find the flow ID of the flow you want to show

                    The flow ID can be found in the Appcues Studio in the URL while editing the flow, or by clicking on the permalink button, or in the sidebar while editing the flow in the Appcues Builder.

                    Step 3: Add the Appcues.show() call

                    In your application code, add a window.Appcues.show() call into the block of code that runs from the user's action. Remember to paste in the flow ID of your flow!

                    Once you've made this change, you'll need to make sure to push these changes to your live application environment where you're wanting the flow to show.

                    Step 4: Publish the flow

                    If you'd like this flow only to show from users clicking the button, set the flow's trigger to Only manually. 

                    As this will be manually triggered, the flow will ignore all page and targeting conditions and fire for anyone that clicks that button. 

                    Step 5: Test it out

                    With the flow published and the Appcues.show() call live in your code, the flow should begin showing whenever you take the appropriate action. 

                    And that's it! Happy building!

                     

                    Alternate methods:

                    Using Appcues.track() and Event Triggering

                    While the above method works just fine, it can be a bit brittle. If you decide you want to show a different flow, you will need to go into your application's code to change the flow ID. If you have Event Triggering included with your Appcues plan, you could instead track an Appcues event using Appcues.track(). 

                    Not only does this allow you to track how many users have clicked this button from the Events Explorer, but it also makes it easy to show Appcues content or not by setting that event as the trigger directly in the Appcues Studio. 

                     Using a permalink

                    A permalink can be a nice, quick way to launch a flow, especially if you're wanting to first send the user to another page in your application before the flow begins showing. In that case, you can add the flow's permalink into something like an anchor tag, like so:

                    launch flows javascript api api appcues.show() manual trigger trigger flow after action

                    Was this article helpful?

                    Yes
                    No
                    Give feedback about this article

                    Related Articles

                    • Host Appcues SDK Under Your Own Domain
                    • Installation Plan
                    • Changing the User ID
                    • User Properties Overview
                    Appcues logo

                    Product

                    Why Appcues How it works Integrations Security Pricing What's new

                    Use cases

                    Appcues Integration Hub User Onboarding Software Feature Adoption Software NPS & Surveys Announcements Insights Mobile Adoption

                    Company

                    About
                    Careers

                    Support

                    Developer Docs Contact

                    Resources

                    The Appcues Blog Product Adoption Academy GoodUX Case studies Webinar Series Made with Appcues Appcues University

                    Follow us

                    Facebook icon Twitter icon grey Linkedin icon Instagram icon
                    © 2022 Appcues. All rights reserved.
                    Security Terms of Service Privacy Policy

                    Knowledge Base Software powered by Helpjuice

                    Expand