
How to Target Qualaroo to URLs Containing Complex Paths and Query Strings
January 31, 2013Our 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.
Capture customer feedback to improve customer experience & grow conversions.
More posts
7 Effective Tips to Increase Survey Response Rates
Learn how to increase your survey response rates with these quick and actionable tips. Get the right insights with delightful brand surveys starting today!
Top 15 Website Optimization Tools (Features, Pros, Cons, & Price)
Build your optimization toolkit with our pick of best website optimization tools. Boost traffic, conversions and CX with these top site optimization software.
25 B2C Survey Questions to Plug the Leaks in Your Sales Funnel
Struggling with a leaky sales funnel? Discover some of the best B2C survey questions to identify problems in your sales funnel and improve customer experience
Customer Feedback Analysis Guide: Secret to Growth Hacking Your Business
Customer feedback analysis is a doorway to the secrets of business growth. Do you want IN on these feedback analytics? We’ve laid it out in the open for you here.
Landing Page Testing – Steps, Tips, Best Tools, & Examples
Want to build a solid landing page testing strategy? Explore this guide to learn practical tips, steps, & best tools to design a successful landing page test.
Prototype Testing: A Step by Step Guide (2022)
Learn how to validate your designs and test your prototype. Discover the best prototype testing practices to create awesome products that sell.
Top 20 A/B Testing Mistakes To Avoid In 2022
Tired of making A/B testing mistakes? Learn about these 20 common mistakes in A/B testing & how to avoid them to enjoy reliable results for your hypotheses.
15 Best Product Marketing Tools For Product Marketers [2022]
Product marketers and marketing managers have a lot on their plate, and not having a reliable toolset add to the frustration.
10 best Usertesting Alternatives- Features, Pros, & Cons Compared
Wondering what the best UserTesing alternatives in the market are? Explore the most detailed list of top UserTesting competitors with features, pros, & cons.
12+ Best JotForm Alternatives & Competitors in 2022
Explore the best JotForm alternatives to supercharge your survey & form-building campaigns. Compare their features, pros, cons, & prices to pick the right one.