How to use Regular expressions when building Destination URL or Custom event type goal

How to use Regular expressions when building Destination URL or Custom event type goal

Find out how to use regular expression to build destination URL or custom event conversion goals.

What are Regular expressions: Regular expressions, often abbreviated as Regex, is broadly understood as a technology to do string matching. Systems that support Regular expressions allow users to use a special string, called the pattern, built using the rules of Regular expressions, to perform complex string searches. This technology is meant for advanced technical users and is extremely effective.

When to use Regular expressions in Destination URL type goal: Bing Ads recommends that advertisers put one tag across their website and create multiple goals. In most cases, advertisers want to track user visits to certain pages as conversions (such as the order confirmation page or thank you page). These advertisers create Destination URL type goals in order to meet their needs. Destination URL type goal supports 4 types of conditions that advertisers can specify on the URL.

  • Equals To: In this case the input string must exactly match with the URL on which the UET event fired. However http(s) and www are ignored (rest of the string must match). For example, if the advertisers provides an input string of, and the URL is or, Bing ads will consider it as a match and vice versa will also be true.
  • Begins With: This matches identical characters starting from the beginning of the string up to and including the last character in the input string. However, http(s) and www are ignored (rest of the string must match). Use this option when your page URLs are generally unvarying but when they include additional parameters at the end that you want to exclude. For example, if you provide an input string of abc, and the URL is or, Bing Ads will consider it as a match and vice versa will also be true.
  • Contains: When this operator is used, Bing ads verifies if the input string is present anywhere in the URL reported by the UET tag. This option was not present in UET v1 but will be supported in UET v2.
  • Regular Expressions: This option is used when none of the options above are able to express the necessary conditions to match the conversion URLs.

Here are some examples and regexes for those examples:

Description Destination URL Regular expression
Look for a specific string in the URL. Such as OrderId. This is basically equivalent to the Contains option. Since UET v1 does not support contains, this can be used in the interim as a workaround."
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 http://yourawesome



  • \ is the escape character
    to be used with \ and .
  • | is used for expressing
    OR conditions
  • Use parenthesis for grouping
Suppose that the conversion URLs have different subdomains. http://domain1.yourawesome



  • * is a wildcard character
  • [a-z] implies any alphabet
  • [0-9] implies any digit

When to use Regular expressions in Custom event type goal: In short, Bing Ads requires that advertisers report values for one or more of the following parameters when custom events happen and create custom event type goal(s) specifying which values for these parameters would qualify a custom event as a conversion. To learn more, see How to report custom events with UET

  • Event category - The category of event you want to track. For example, 'video
  • Event action - The type of user interaction you want to track. For example 'play' or 'pause' etc
  • Event label - The name of the element that caused the action. For example 'trailer' or 'behindthescenes' etc
  • Event value - A numerical value associated with that event. Could be length of the video played etc.

Of these four parameters, the first 3 - Event category, Event action and Event label allow regular expressions to be specified. The rules of the regular expressions are the same as what is described above for destination URL type goals.

  • In the unlikely case that both you and Bing Ads support aren't able to define a regex for your conversion URLs, you can provision a new UET tag, put the tag only on the conversion pages and create a Destination URL goal with a dummy condition (such as contains . ) that always evaluates to true. Because the tag will be fired only on the conversion URLs, you will be tracking only visits to those pages as conversions.
  • Regular expressions is a complex topic. There are free tools available online (for example: that can assist you in building and validating their regular expression patterns with your conversion URLs. ​ ​

See more videos...