Imagine this: a customer signs up for your SaaS product, and instantly a personalized product tour greets them, walking them through the core features relevant to their specific subscription tier. Or perhaps a user completes a key certification in your learning management system, and automatically a DoBeacon tour kicks off, highlighting advanced features they've just unlocked. Sounds slick, right? Most of us are used to tours that trigger on page load or after a manual click, but what if you could fire them off based on anything happening in your user's journey within your application?
Today, we'll explore how to achieve flexible and dynamic tour triggering by leveraging DoBeacon's SDK. This allows your application's code to programmatically start tours based on various client-side events or data, enabling highly personalized user guidance.
The Problem with Manual Tour Triggering
Historically, creating dynamic and personalized product tours often required developers to hardcode specific triggers for every scenario. Linking an in-app event, such as a user reaching a certain milestone, to a specific product tour meant asking an engineer to write custom client-side logic to detect that event and then trigger the tour. It's a perfectly valid approach, but it can be slow to implement and maintain. Developers often have a long list of core product features to build, and building one-off tour triggers for marketing or success teams can fall to the bottom of the backlog. This friction means that many teams just don't bother, or they resort to less personalized, static tours.
I've seen this play out in too many places. The engineering team is swamped, and the product or success team wants to move fast, to react to user behavior now. DoBeacon's SDK provides the programmatic control needed to implement these dynamic triggers efficiently, allowing developers to integrate tour activation into your application's existing event-driven architecture.
How DoBeacon's SDK Enables Programmatic Tour Control
DoBeacon's SDK provides methods to programmatically control tours directly from your application's client-side code. This means you can integrate tour activation into your existing application logic, responding to user actions, data changes, or other in-app events.
The basic flow leveraging the SDK looks like this:
- A relevant event occurs within your application (e.g., a user clicks a button, completes a form, or new data loads).
- Your application code detects this event. This might involve listening to your application's internal event bus or observing state changes.
- Your code then calls
DoBeacon.startTour(id)with the ID of the tour you want to initiate for the current user. - DoBeacon's SDK, embedded in your application, plays the specified tour for that user.
Additionally, to personalize tours and track user-specific progress, DoBeacon.identify() is crucial. This method links the current browser session to a known user in your system, associating their activity with a unique identifier and metadata like name, email, or plan.

Step-by-Step: Programmatically Activating a DoBeacon Tour
Let's walk through how to set up a tour that can be triggered from your application's code using the DoBeacon SDK. This approach empowers your developers to integrate tours precisely where they are needed, based on in-app logic.
1. Prepare Your DoBeacon Tour and Identify Users
First, ensure you have a tour created and published in DoBeacon. You'll also want to make sure your users are identified in DoBeacon to track their progress accurately.
-
Get your Tour ID: Head into the DoBeacon dashboard, select your project, then your tour. The Tour ID is part of the URL when you view the tour in the builder, or you can retrieve it programmatically using
DoBeacon.getTours(). Example:64f1a2b3c4d5e6f7a8b9c0d1. -
Install the SDK: Ensure the DoBeacon SDK is installed in your application. This is typically done via a script tag or npm. Find your project API key (
pk_live_...) on your project's page in the dashboard and embed it during SDK initialization. This key is safe to expose publicly, as it only allows reading published tours and posting analytics events. -
Identify your users: Call
DoBeacon.identify(userId, metadata?)in your application after a user logs in. This links the current browser session to a known user ID and allows you to pass additional data like theirnameoremail, which is useful for analytics and personalizing the chat panel.// Example: Identifying a user after login DoBeacon.identify(user.id, { name: user.name, email: user.email, plan: user.subscriptionPlan // Optional metadata });This ensures that when a tour is played, it's attributed to the correct user in your DoBeacon analytics.
2. Implement Client-Side Tour Triggering
Now, let's write the JavaScript code in your application to trigger the tour. This could be in response to a button click, a page load condition, or any other event your application handles.
-
Calling
DoBeacon.startTour(id): This is the primary method to manually launch a tour.// Assume 'YOUR_TOUR_ID' is the ID you copied from the dashboard const tourId = 'YOUR_TOUR_ID'; // Example: Triggering a tour on a button click document.getElementById('start-onboarding-button').addEventListener('click', () => { DoBeacon.startTour(tourId); }); // Example: Triggering a tour based on a specific URL path if (window.location.pathname === '/welcome-dashboard') { // DoBeacon methods are safe to call early; they will no-op until init() has run. DoBeacon.startTour(tourId); } -
Conditional Triggering: You can add logic to
startTour()calls to ensure tours only play when appropriate. For instance, check if a user has already completed a tour:async function launchWelcomeTour() { const tourId = 'WELCOME_TOUR_ID'; // Replace with your tour ID const hasCompleted = await DoBeacon.hasCompleted(tourId); if (!hasCompleted) { DoBeacon.startTour(tourId); } else { console.log('User has already completed the welcome tour.'); // Optionally, offer to restart it // DoBeacon.restartTour(tourId); } } // Call this function when relevant in your app launchWelcomeTour();
3. Test Your Programmatic Trigger
To verify your setup, navigate to the part of your application where your programmatic trigger is implemented.
- Execute the trigger: Perform the action that should call
DoBeacon.startTour(). - Observe the tour: The specified tour should start playing.
- Check console for errors: Look in your browser's developer console for any JavaScript errors.
- Verify analytics: Confirm that the tour play is recorded in your DoBeacon dashboard under Analytics.
By integrating DoBeacon.startTour() into your application's client-side logic, you gain granular control over when and how tours are presented to your users, making them an integral part of your product's user experience.
Practical Use Cases
The possibilities for using client-side programmatic triggers are quite vast. While direct server-side integrations for triggering tours from external systems like Zapier are not a DoBeacon feature, you can still achieve highly dynamic experiences by:
- Passing relevant data to your client-side application: Your backend can pass user state, feature flags, or event data to your frontend when a page loads or through real-time updates.
- Using this data to drive client-side logic: Your frontend code can then evaluate this data and call
DoBeacon.startTour(id)when specific conditions are met.
Consider these scenarios, where your application's frontend could dynamically trigger tours:
- Feature Unlocks & Upgrades: When your application detects that a user's subscription tier has changed (e.g., from a backend payload on page load), or a new feature becomes available, a client-side call to
DoBeacon.startTour()can introduce the new capabilities. - Milestone Achievements: Upon a user completing a significant in-app task (like creating their first project or inviting a team member), your application's event handler can trigger a celebratory or next-step tour.
- Contextual Help: If a user navigates to a complex page for the first time, your application can check their history or a 'first_visit' flag and programmatically launch a tour to guide them.
- Internal Workflow Guidance: For internal tools, if an admin performs an action that changes a record's status, the client-side interface could initiate a micro-tour guiding them on subsequent steps related to that status change.
This kind of proactive, context-aware guidance dramatically improves user experience and product adoption. While it involves some client-side code to set up these triggers, the tour content itself remains no-code to build and manage in the DoBeacon dashboard, streamlining the overall process.
Ready to integrate powerful, perfectly timed tours into your application? Build your first tour for free at https://dobeacon.com/signup



