All Collections
Targeting & Triggering
Triggering materials using Regex
Triggering materials using Regex

Learn how to use URLs and regular expression (regex) to ensure your guides show on the correct page.

Gabriel avatar
Written by Gabriel
Updated over a week ago

Overview

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

This tutorial explains 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 your content's Page Targeting condition, 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 in panel.userguiding.com and 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 the expression into the URL field. The total 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.

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$)

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/*

Did this answer your question?