Overview

Contents at UserGuiding (guides, hotspots, checklists, and NPS) can be set to show on a particular page or pages within your web app depending on the page URL.

In this tutorial, we explain how you can use the regular expression (regex) to trigger a UserGuiding Content on a page with a dynamic URL.

Page Targeting

When crafting new content, you should make sure you're setting it to show on the correct page. To do this, you will need to find Page Targeting and set-up a condition with targeting rules and URLs.

So when the current page URL matches with the Page Targeting condition of your content, it can start.

In the example below, the current URL matches the Page Targeting condition of a guide called "My Welcome Guide".

Current URL:

Page Targeting Condition:

You can find Page Targeting in the Settings Page of contents both in panel.userguiding.com and in Chrome Extension.

URL matches regex

A regular expression (regex) is a codified way of creating a pattern for a string. You can choose regex as a rule to create a general matching condition that follows some rules.

To use a regex, select the regex as your rule and type in the expression into the URL field. The full URL input will be treated as a regular expression, and the condition for your Target Page URL will be set.

And, UserGuiding content will show on pages whose URL matches the regular expression defined in the URL field.

πŸ‘‰ Understand how regex works

Regex example

Some examples of regular expressions include:

  • [a-z]: to represent any character between a-z
  • \d: to represent any digit
  • a+: to represent one or more a's
  • $: to end the string and prevent any subsequent text matching

Use case example: To show a guide on yourplatform.com but not yourplatform.com/index, use the URL input: yourplatform.com$)

πŸ‘‰ Explore a reference guide on regex expressions

How to trigger a Guide on a page with a dynamic URL?

Let’s assume your dynamic URL changes from https://myplatform/users/0000, then to https://myplatform/users/0001, then to https://myplatform/users/0002, and so on.

To create that dynamic Page Targeting condition and display your guide across all these URLs:

  1. Go to the Settings page of the guide.
  2. Select regex as your Page Targeting Rule.
  3. Add the dynamic URL by entering a * to replace the user-specific part. Thus, your condition would look like this https://myplatform/users/*

Related Articles:

How do I show a guide on multiple pages?

How can I test my UserGuiding Content?

Did this answer your question?