Our customers often tell us that the ability to target the right customer in the right context is one of the things they value most about Qualaroo. Generally, URL targeting is one of our simplest forms of targeting we offer. It lets you quickly and easily configure on which page of your site your survey or Nudge™ will appear. But occasionally pages have more complex URL structures where our standard URL targeting is insufficient.
For example, a large retailer wanted to survey users browsing the lists of products in a category, but not the pages containing individual product descriptions. We could not support this scenario. Also, an agency wanted to target a Nudge™ to a shopping cart page that contains a promotion code. However, this was not possible with our standard targeting, because each promotion code changes the page URL.
Fortunately, Qualaroo now offers a flexible solution for these situations. Customers can specify a regular expression as a URL targeting criterion (a good tutorial can be found at https://www.regular-expressions.info/).
How it Works
For the promotion example we mentioned earlier, suppose that the marketing team wish to target a Nudge™ to any shopping cart page that has a promo code. The relevant URL might be of the following form:
https://company.com/section/cart?promo=abc123
Further, let’s say that the development team wish to test their Qualaroo Nudge™ in the staging environment first, before deploying it to production. Assuming that the staging site is deployed on staging.company.com, the target URL becomes:
https://staging.company.com/section/cart?promo=abc123
With these requirements, the regular expression that will match any URL in the staging environment of company.com and containing a promotion code is:
/^(https?://)?staging.company.com/section/cart?promo=(.*)?$/
We start with the beginning of the pattern (“^”), then follow it with an optional “https://” or “https://”, then the add the staging domain, followed by the cart section (“staging.company.com/section/cart”). Next, we specify the query string character (“?”) and the pattern for the promotion code (“promo=”). After that, we allow an optional promotion code containing any characters. If needed, the promo code could be further restricted (e.g., to start with a letter and contain only letters and digits). Finally, we finish with the ending of the pattern (“$”).
More Tricks
Even more advanced pattern matches are supported. Suppose you have an ecommerce site with numerous listings in multiple categories: for example, dog beds, dog crates, and dog food are some of the product categories you have on your site. The site structure for this (fictitious) dog care site might look something like this:
https://dogmart.com/dog-beds.html
https://dogmart.com/item1230-serta.html
https://dogmart.com/item4560-hidden-valley.html
https://dogmart.com/dog-crates.html
https://dogmart.com/item2341-prevue.html
https://dogmart.com/item7629-lucky-dog.html
https://dogmart.com/dog-food.html
https://dogmart.com/item3085-canidae.html
https://dogmart.com/item2468-natural-balance.html
The URL patterns are: https://dogmart.com/product_type.html for the section pages and https://dogmart.com/item####-brand_name.html for the product detail pages.
Let’s say that you want to display a Nudge™ to users who are browsing any of the section pages of your site (e.g., /dog-food.html), but refrain from prompting people who land on the individual product (“unique item”) pages (e.g., /item2468-natural-balance.html).
The negative lookahead construct of Regular Expressions is indispensable when you want to match something not followed by something else. Here is the pattern that would work well for our example:
/^.*/[w-]*/(?!itemd*)[w-]*.html.*$/
We start with the beginning of the pattern (“^”), followed by zero or more occurrences of any character, and then the forward slash (“/”). After that, we allow for zero or more sets containing regular word characters or a hyphen, followed by another forward slash. So far, this pattern will match any characters preceding either a section page (e.g., dog-food.html) or a product page (e.g., item2468-natural-balance.html). Next, per our requirement of where the Nudge™ should be shown, we specify the pattern that must not be matched. This is the word “item” between the delimiters “(?!” and “)”. The latter pair denotes the “negative lookahead”. We finish the pattern with zero or more sets containing word characters or a hyphen and finally “.html” so as to ensure that section pages are allowed. We conclude with the ending of the pattern (“$”).
Depending on the structure of your site, a slightly simpler pattern //[w-]*/(?!itemd*)[w-]*.html/ may yield equivalent results.
Please note that the characters ., |, (, ), [, ], {, }, +, , /, ^, $, *, and ? are special, because they are part of Regular Expressions syntax. Hence, in our examples, we “escape” their occurrences with the special character “” (the backward slash).
Lastly, when working with Regular Expressions, always experiment and test!
Availability
This feature is available in our Small Business and Professional plans. The plans come with a 30 day free trial – please feel free to sign up and contact us at support@qualaroo.com to enable this feature for you. If you are already on one of these plans, just email support if you would like to give it a try.
Once enabled, you will see an additional field in the Qualaroo Configuration screen (part of the Administration UI), where you can paste a regular expression. Qualaroo supports the standard Regular Expressions format, where the pattern must begin and end with the forward slash character (“/”). Any legal regular expression pattern can be placed between the forward slashes as long as it contains your site’s domain.
Conclusion
During our ongoing work at Qualaroo with large businesses and agencies, it became apparent that complex websites require much more flexible URL targeting than the standard selections, such as domain and path. Regular Expressions is the most general pattern matching mechanism, and it is now available to Qualaroo customers as part of our Small Business and Professional plans.
FREE. All Features. FOREVER!
Try our Forever FREE account with all premium features!