Targeting user events

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.

1. Add HelpHero.update() script

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>
Note: If you are tracking an event that is not dependent on existing user properties, you can pass the object to HelpHero.update() instead of using a function.
There's an example of tracking a button click
<script>
  document.getElementById("cancel").addEventListener("click", function() {
    HelpHero.update({ hasCancelled: true }); 
  });
</script>

<button id="cancel">Cancel</button>

2. Setup a funnel

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.