IMPORTANT NOTE: This post was published several months ago; the information contained in it may no longer be accurate. For the most current information on this topic, please visit the most recent blog post or the Help file.
What is Universal Event Tracking (UET)?
UET is a tool available to Bing Ads customers to track conversions and other site activity, announced in October. You can find this functionality in the Campaigns Page of Bing Ads. For an overview and to get started, see this Help page.
What Are Regular Expressions?
Regular expressions, often abbreviated as Regex, are a special text string used to find a search pattern. They are a powerful tool for finding text, and can be used in Bing Ads to track more sophisticated conversion goals. If you’re familiar with UET, you’ll be pleased to know we’ve added regular expressions to your UET toolbox to help enable you to track your own custom goals beyond the ones listed.
In the Campaigns page, click on View Goals and Conversions
When To Use Regular Expressions
Suppose you have a URL that looks something like this:
http://yourawesomecompany.com/products/XXXX/checkout.html where XXXX represents any text corresponding to some product.
If you have Universal Event Tracking enabled for your site, conversions will be logged when a user visits checkout.html. You can then track your customer conversions over time. However, what if you don’t want every product order to count as a conversion? For example, you want expensive cars to count as a conversion and not chewing gum. This is where regular expressions can help you!
Examples of Using Regular Expressions
Example 1: Suppose that instead of counting every product order as a conversion, you specifically want to track those in which a user purchases your expensive items: fancyjewelry or fancycar, for example. How can you do this?
Answer: Use “|” in place of “or” to get the regex fancyjewelry | fancycar
Surround each product by parenthesis to make explicit that fancyjewerly and fancycar are two different items and you get the regular expression, or regex, as: “(fancyjewelry) | (fancycar)”
The full regex expression is then:
http://yourawesomecompany\.com/products/(fancyjewelry) | (fancycar)
You might have noticed those weird "\” symbols popping up in front of the “.”, this is a necessary process called escaping and is explained under the tip section at the end of this blog post.
Example 2: Now it is conceivable that you might have many fancy cars to sell and you index them using numbers: fancycar1 , fancycar2, fancycar3, ….
You’ll get bored typing (fancycar1) | (fancycar2) | (fancycar3) | … and that’s where regular expressions come to the rescue again. How so:
Answer: First we need a more general way to represent the numbers 1 through 9, which you can do this with a regular expression, as follows:
To track fancycar1 through fancycar9 you would use the regex: fancycar[1-9]
The full regex expression you want to use:
Example 3: Using “*”. What if you wanted to count conversions for more than 9 cars? Regex provide another solution using the * operator, which will simply match arbitrary repetitions of the previous element. As an example a* will match a , aa, aaa, aaa….
The regex fancycar[1-9]*would identify the pattern of fancycar followed by any arbitrary number of digits:
e.g: fancycar1, fancycar12, fancycar35, fancycar21735912753 …
So the end expression would look like:
Example 4: Using “.”operator
Suppose you don’t index your fancycar by numbers, but rather index it using digits or characters. Regular expressions make it easy to track that as well. To do so, use “.” operator which can match any character whether it’s the number “5” or letter “q.” So to track conversions for fancycar followed by anything you should use the regex: fancycar.*
Here is what the expression will look like:
You might have noticed that certain regex commands like “ . “ coincide with actual characters you might want to match, like the “ . “ in “yourawesomecompany.com.”
To distinguish between the two you can use what’s called escaping, via another special command: “\”. The final URL would thus look as follows:
yourawesomecompany\.com will match yourawesomecompany.com
So remember, don’t forget to escape those pesky " . " in your URLs!
is still not a fully working regex, to fix it simply escape each . by a \ operator before it to get:
What if you want to escape the escape command "\" ? You can also do that using the very same escape command " \ ". In other words, the regex " \\ " will match the character " \ "
If You’ve Reached This Point…
You probably want to learn more. For the power of regular expressions and some of the gotcha’s involved in using them, I recommend you visit http://msdn.microsoft.com/en-us/library/az24scfc(v=vs.110).aspx . Also don’t forget to visit the UET documentation for specific steps and process for enabling UET.
If you have any further questions feel free to comment below and I will help you out!
Program Manager, Bing Ads Platform