Acquire
  • Home link-arrow
  • Settings link-arrow
  • Workflows link-arrow
  • Using URL Match Conditions in Business Rules

Using URL Match Conditions in Business Rules


When visitors are on a certain webpage of your site, you might want to trigger a Business Rule to let them know about a special promotion. To do this, use the Visitor Page Matching condition in Business Rules. URL matching allows administrators to match URLs based on different criteria. Acquire offers five types of matchings: 

Contains or Not Contains: Indirectly matches based on criteria 

Is and Is Not: Matches based on if the URL exactly matches the criteria

Regex Match: Uses regex expressions to match patterns in URLs

Query Match: Directly matches an exact query parameter

Param Match: Directly matches an exact URL param, slug, or path

In this article:

  • Using URL Matching in Business Rules 
  • Contains and Not Contains 
  • Is and Is Not 
  • Regex Match
  • Query Match 
  • Param Match 
  • Troubleshooting 

Using URL Matching in Business Rules 

To use a URL matching condition in a Business Rule, you’ll need to use a Chat Business Rule. After creating a chat-based Business Rule, click on the ‘Add a Condition’ action, then choose ‘Visitor Page URL’.

Add-visitor-Condtions-page-open-31f48d0f73c78c62229e67a6.png

From the drop-down menu, choose a conditional. 

Add-visitor-conditons-if-visitor-page-URL-1336979690c08279b5975bff.png

Use ‘Contains’ and ‘Not Contains’ to match keywords or patterns within a URL. The ‘Contains’ match is considered a fuzzy match, meaning it will match URLs that aren’t an exact match. 

Let’s say you’d like to trigger a Business Rule on your entire site (https://mystore.example). You could use the ‘Contains’ condition to do so. 

Add-visitor-conditions-If-visitor-page-URL-contains-mystore-c0f717c36b5d076fc2238baf.png

In this example, the condition will match if the page the visitor is on contains the sequence mystore

Using ‘Not Contains’ will have the opposite effect, matching every URL that does not contain the word mystore

Is and Is Not

To match exactly, use the ‘Is’ condition. The ‘Is’ condition is best used when you want to trigger an action on a specific page. Let’s say you’d like to display a coupon each time a visitor is on the product page: https://mystore.com/product/AA00. You could use the ‘Is’ condition to specify that page.

matching-use-the-is-condition-62018bb92febe9e189349af8.png

You’ll need to have the full URL to use the ‘Is’ condition. 

Using ‘Is Not’ will have the opposite effect, matching every URL that does not contain the exact URL specified. 

Regex Match 

Sometimes you need to match a range of URLs. Let’s say you have an online store and you want to display a coupon in the widget. However, you only want to display the coupon on the product pages, and not on the home page.

For example, let’s say the product pages you’d like to match are: 

https://mystore.example/product/AA00, https://mystore.example/product/AA01, etc. 

You don’t want to display the coupon on the products home page which is https://mystore.example/products

You wouldn’t be able to use “Contains” as all URLs have the word ‘product’ in them. 

Use regex to match the URLs based on specific conditions. 

Add-visitor-page-conditions-if-vistior-page-url-match-regex-URL-of-product-page-c124b1f73c860eb91faad0cb.png

In this example, the pattern will match all pages that start with the base URL https://mystore.example/product/. You may notice backslashes in the URL, which represent escaped characters.

Matched vs Unmatched URLS:

Regex match is the best way to capture URLs that are rendered dynamically. Additionally, we can also use query matching and param matching when we need to capture specific parameters and queries in the URL. 

Query Match

Sometimes you need to match a URL exactly. However, that URL could have query params and substrings that make matching difficult with Regex alone. To accomplish this, use query matching. 

For example, let’s say you want to display a 10% off coupon for a product that contains the query param id=12. However, you don’t want to display the coupon if the product has a similar query param, id=122. 

Use query matching to specifically match the product with id=12. 


query-match-with-id-equal-to-12-d7b76b5e3abcf8301f769f5e.png

This will match each URL that has an id=12, but will not match similar substrings. 

Matched vs Unmatched URLS:

Param Match

In some cases, you may have URLs that point to the same product page that you want to display a coupon for. While it’s possible to use Regex to match these two different URLs, it’s easier to use parameter matching. 

Let’s say you have a product page selling the iphone 13 (https://example.com/products/345). However, you also want to display the coupon on the features page of your website (https://example.com/products/i-phone-13). 

To do so, use param match. 

param-match-for-345-and-iphone13-c916ab2315955c6694f2fbda.png

This match will identify any of the urls containing 345 or i-phone-13. It will also ignore pages with similar URLs. 

Matched vs. Unmatched URLs:

Troubleshooting

Regex, query, and param matches must be valid. You will not be able to save conditions with invalid matches. Invalid matches will have a red boundary box displayed around them. To correct this, use a valid pattern. 

Invalid regex match: 

regex-invalid-sequence-with-red-boundary-box-dc81360bc4ea5fac4a69c89a.png

Invalid query and param matches: 

inavlid-query-and-param-match-with-red-border-d306ba1514e3846d23d69e0a.png

Not sure if a sequence will match? Use the testing site regex101 to test out examples.

Use URL matching to give customers a specialized experience. 

Having trouble? Reach out to support@acquire.io

Additional Resources


Related Articles