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
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’.
From the drop-down menu, choose a conditional.
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.
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.
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.
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:
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.
Matched vs Unmatched URLS:
- https://mystore.example/product/AA00 (matched)
- https://mystore.example/product/AA01 (matched)
- https://mystore.example/product/BB27 (matched)
- https://mystore.example/products (not matched)
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.
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.
This will match each URL that has an id=12, but will not match similar substrings.
Matched vs Unmatched URLS:
- https://r1uh0n.acquire.io?id=12 (matched)
- https://r1uh0n.acquire.io?id=12345&id=123 (not matched)
- https://r1uh0n.acquire.io?id=1234555 (not matched)
- https://r1uh0n.acquire.io?id=12345&id=12&cat=1234 (matched)
- https://r1uh0n.acquire.io?id=12345&id=123&cat=1234&id=123 (not matched)
- https://r1uh0n.acquire.io?id=12345&id=123&cat=1234&id=12 (matched)
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.
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:
- https://example.com/products/345 (matched)
- https://example.com/products/3455 (not matched)
- https://example.com/products/34 (not matched)
- https://example.com/products/i-phone-13 (matched)
- https://example.com/products/i-phone-133 (not matched)
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:
Invalid query and param matches:
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 email@example.com.