How to use URL operators to build URL patterns

Definition

In this article, we'll take a look at the different operators for building URL patterns and how you can manipulate and mix them to recreate URL pattern rules that meet your needs. 

URL patterns are rules that allow you to create groups of URLs that share these rules. They're mandatory to declare your campaigns' targeting, create specific segments or triggers and of course create saved pages and map your website. 

For example, if I want to create an URL pattern "all product pages", I will identify what's in common in all the product pages of my website to build the rule. Here it could be contains '/product/'

The URL template needs to be as inclusive as possible, to make sure that 100% of the product pages on my website match the rule, in our example. But at the same time, the URL model must also be exclusive, to ensure that pages that aren't product pages don't match the rule.

To build these rules, we offer 8 operators that should enable you to create all the URL patterns you need to map your website.

Operators

This is the list of operators available to build your URL patterns:

Operator Functional: accepts...
is

Includes all URLs matching the string, even if they include parameters

⚠️ With this operator, the page is targeted no matter which parameters are included in the URL. Therefore, you cannot write any particular parameter in this field.

Example: https://mydomain.com/cart

is exactly

Includes the unique URL matching the exact string. Parameters that are not mentioned in the string are not taken into account

💡 This field accepts parameters as an option.

Example: https://mydomain.com/cart?news

contains

Includes all URLs containing the string. Parameters following the string will also be taken into account.

Example: /product/

is regular expression

Includes all URLs matching the regex. You don’t need to escape special characters of your regular expression.

Example: https://www.example.com

/products/(.*)--([0-9]{5})

is not

Excludes all URLs matching the string, even if they include parameters

⚠️ This field doesn’t accept parameters.

Example: https://mydomain.com/cart

is not exactly

Excludes the URL matching the exact string.

💡 This field accepts parameters as an option.

Example: https://mydomain.com/cart

does not  contain

Excludes all URLs containing the string. Parameters following the string will also be taken into account.

Example: /product/

is not regular expression

Excludes all URLs matching the regex. You don’t need to escape special characters of your regular expression.

Example: https://www.example.com

/products/(.*)--([0-9]{5})

Mixing inclusions and exclusions

Inclusion(s) only in your URL pattern

If you include one or several specific URL(s) entirely, all the other URLs which don't match the rule will automatically be excluded from the URL pattern rule. To be accepted to the rule, an URL will have to match at least one of them.

Exemple: URL Pattern "checkout"

Includes the following conditions:

is www.mywebsite.com/basket OR www.mywebsite.com/delivery OR www.mywebsite.com/payment OR www.mywebsite.com/thankyou

This URL pattern will accept all the pages of the checkout without any exception, whatever some parameters are added in the URL, and won't accept any other page of the website.

You can decide whether you want all conditions to be met, or at least one. This is the difference between the “some” and “all” options.

In our exemple, with entire URL, the some option should be chosen.

Combination of inclusions and exclusions 

You can combine inclusive operator(s) (is, is exactly, contains, is regular expression) with exclusive operator(s) (is not, is not exactly, does not contain, is not regular expression). 
In this case, to be accepted in the pattern rule, a website’s URL has to match:

  • All the exclusion rules
  • Some (at least one) of the inclusion rules

Exemple: URL Pattern "All pages except checkout"

Includes the following conditions:

contains www.mywebsite.com

AND

is not www.mywebsite.com/basket AND www.mywebsite.com/delivery AND www.mywebsite.com/payment AND www.mywebsite.com/thankyou

⭐ Good to know

Adding exclusions only in a pattern rule is not possible. To work properly, the rule has to be filled with almost one inclusion condition. Otherwise the rule will never work with any URL. If you want to add one or several exclusions, you need to add at least one inclusion (the entire website for example)

Use cases

Here are some examples of configuration, depending on the pages of your website you want to target:

  Target the homepage of your website

  URL operator

  is

  URL

  http://mydomain.com

  Result

The modified page will be seen by your visitors, including those being redirected from partner websites or having clicked on sponsored links. In this case, the URL displayed in their browser is followed by UTM or other tracking parameters. However, AB Tasty recognizes the URL regardless of the parameters linked to it and displays changes to the relevant visitors.

  Example of a URL

  You will target the http://mydomain.com page, as well as http://www.mydomain.com/?utm_medium=email and even http://www.mydomain.com/?utm_medium=cpc.

  Target all category pages of your website

  URL operator

  Contains

  URL string

  /category/

  Result

  The changes are applied to all pages for which the AB Tasty platform has identified the common section of URL.

You must make sure non-desired pages aren't included by mistake because they contain the same section of URL: as a safety precaution, you may use a regular expression.      

  Example of a URL

  You will target the http://mydomain.com/category/page1 page, but also http://mydomain.com/category/page1/article.html.

  Target all the product pages of your website.

  URL operator

  Is regular expression

  Full URL

  http://www.example.com/products/(.*)--([0-9]{5})

  (For example if your URLs match the following format:   http://www.example.com/products/product-name--12345, where 12345 coincides with a 5-digit product ID)

  Result

  A regular expression enables you to use a strict writing rule to define the pages to be targeted. This guarantees that you will include only the pages that need to be, particularly if your pages share a structure and include a set of digits and letters. 

  Example of a URL

  You will target the http://www.example.com/products/shoes-children--96753.html

  or http://www.example.com/products/garden-furniture--13082 pages.

Focus on All and Some operators

All and Some operators enable you to combine several conditions within a set-up in the targeting step such as a segmentation or a triggering criterion. They appear in a drop-down list when two or more conditions are added. In most cases, both All and Some operators are available.

Operator

Definition

Example

Some

The set-up matches at least one of the conditions.

In the Geolocation criterion: target visitors located either in France OR in the United States.

All

The set-up matches all the conditions, without exception.

In the Content interest criterion: target visitors interested in BOTH skirt and dress.

 

 

Was this article helpful?

/