0

I'm trying to exclude (in a Goal) a character in a regex in Google Analytics.

Basically, I have two pages with the following URL:

/signup/done/b
/signup/done/bp

Note that both might have UTM parameters after in some results as well

I am trying to measure only /done/b

The Regex I had was the following, but it includes both strings:

(/signup/done/plan/b)

When I changed it (and verified it in an external regex tester) I got 0 results, so the /b/ was also not included.

(/signup/done/plan/b[^p])
nyuen
  • 8,829
  • 2
  • 21
  • 28
avi
  • 180
  • 7

1 Answers1

1

This regex would handle the case where the URL ends with /b or if there are query parameters:

/signup/done/b($|\?.*)

So examples of converting URLs would be:

/signup/done/b
/signup/done/b?utm_campaign=test&utm_medium=display
/signup/done/b?query=value

Examples of non-converting URLs would be:

/signup/done/bd
/signup/done/b/something
nyuen
  • 8,829
  • 2
  • 21
  • 28
  • Good answer. Avi, you can verify the regex syntax here: http://www.analyticsmarket.com/freetools/regex-tester – Andrew C Feb 13 '17 at 18:30