In some cases you may want to only show certain tours to users if they have performed an action or in response to an event. In this example we are going to show the user a tour if they have visited the checkout page more than 3 times.
Add a script to the checkout page which will call HelpHero.update() after your HelpHero installation scripts. This example checks to see if the user already has a checkoutVisits
property, if so the script will add 1 to the visit count otherwise it will start the count from 1.
<script> HelpHero.update(function(user) { return { checkoutVisits: user.checkoutVisits ? user.checkoutVisits + 1 : 1 }; }); </script>
<script> document.getElementById("cancel").addEventListener("click", function() { HelpHero.update({ hasCancelled: true }); }); </script> <button id="cancel">Cancel</button>
Now that you are tracking this event as a user property you can setup a tour to only show if the user has visited the page more than 3 times. In the HelpHero Editor edit your tour and add a new funnel step after the first URL match.