URL redirect tests allow you to compare different versions of a page by sending visitors to alternate URLs. Proper URL matching is crucial for setting up effective redirect tests. This article will explain how to use URL matching patterns for your URL redirect experiments.
Understanding URL Structure
Before setting up URL matching, it's helpful to understand the basic structure of a URL:
https://www.example.com/products/category/item?color=blue#details
Protocol: https://
Domain: www.example.com
Path: /products/category/item
Query parameters: ?color=blue
Fragment: #details
URL Matching Patterns
ABConvert supports several URL matching patterns for redirect tests:
Starts with, Ends with
Matches URLs that start or end with the specified string. Ignores query parameters and fragments.
Example: /products
Will match:
Matches Exactly
Matches the entire URL exactly, including query parameters.
Example: /products?color=red
Will only match that exact URL.
Contains
Matches URLs that contain the specified string anywhere.
Example: products/shoes
Will match:
Matches Regex Exactly
Allows complex pattern matching using regex.
Example: ^https:\/\/www\.example\.com\/products\/[a-z-]+$
Will match:
But NOT:
Common Regex
Pattern | Description | Example |
| Matches the start of a string |
|
| Matches the end of a string |
|
| Matches any single character |
|
| Matches zero or more of the preceding character |
|
| Matches one or more of the preceding character |
|
| Matches zero or one of the preceding character |
|
| Matches any digit (0-9) |
|
| Matches any word character (a-z, A-Z, 0-9, _) |
|
| Matches any whitespace character |
|
| Matches n or more occurrences of the preceding character |
|
| Matches between n and m occurrences of the preceding character |
|
Comparison Chart
Here's a table using the URL https://abconvert-ob-test.myshopify.com/collections/all
to demonstrate different match types:
URL Pattern | Starts With | Ends With | Matches Exactly | Matches Regex Exactly | Contains |
| V | X | X | X | V |
| V | V | V | V | V |
| X | X | X | X | V |
| X | X | X | Matches | X |
Best Practices
Start with simple matching when possible
Use
Starts with
orEnds with
for pages with important query parametersTest your matching patterns before launching the experiment
Troubleshooting
If your URL matching isn't working as expected:
Double-check for typos in your URL patterns
Ensure you've selected the correct matching method
Test with multiple sample URLs to verify the pattern
Use the ABConvert preview mode to test matching in real-time
By mastering URL matching patterns, you'll be able to set up precise and effective URL redirect tests across your website. Remember to monitor your tests closely and analyze the results to make data-driven decisions about your page variations.
If you have any questions or feedback, feel free to email support@abconvert or reach out through the support widget.
Happy testing π