Targeting a Basic Query String

One of the most popular used or regular expressions is to target a URL containing a query string. The query string can be used for a variety of purposes, including promo codes, tracking advertising campaigns, and searches within a website.

Basic Query String - Facebook click-through

The basic query string regex is very simple - you escape the question mark, and any other special characters like slashes for site sections or periods for file types.

Here's a Buzzfeed article that was clicked on through a link on Facebook:

Notice that the Facebook tracking ID is the string at the very end - bffb - and is separated from the rest of the URL path (/author/story-name) with a single question mark. Using a regular expression, we can target any Buzzfeed story page that a visitor landed on through a Facebook link.

To use this example, you would add the following to your regex fields:

Subdomain: www


Path: .*\/.*\?bffb

Now, any page with the format

will be shown a survey. The slashes between sections must be escaped, and to make it easy, we've allowed anything to be in those slashes by using .* See this page for a review of Dot-Star.

Basic Query String - Email Promo Code

Many websites have ways of tracking promo codes within their websites, so that discounts can be applied at checkout while a visitor shops through the site. It's very easy to piggy-back your survey onto these promo codes.

Say you want to send a discount to some of your best customers, giving them free shipping and $25 off their next purchase. They can get this discount by clicking a link in the email you send them with a personalized promo code, but you want to drum up some more excitement.

You can create a survey asking them what they'll buy with their discount, tell them you'll tweet their responses, and the one that gets the most retweets will get a free gift with their purchase. Awesome!

Here's one way you could target your survey, so that the page they land on when they click through the email will show the survey you created.

To use this example, you would add the following to your regex fields:

Subdomain: www


Path: products\/new_items\?promo=shipping.*

This way, anyone landing on

with a promo code matching the pattern above ("shipping" followed by anything else, like a customer ID) will see the survey.


Back to the beginning - Previous - Next

Have more questions? Submit a request
Powered by Zendesk