+4 votes
by (6.7k points)
Hey guys, I'm trying to write a regex "or" statement to track Bing conversions from urls containing either: /checkout_finalize_mc OR /checkout_with_pay_token Can anyone weigh in on the best way to get this done? I'm light on regex and concerned the underscores could also have an unintended effect. Any help appreciated!  
Hey guys, I'm trying to write a regex "or" statement to track Bing conversions from urls c

3 Answers

+3 votes
by (3.1k points)
 
Best answer
If exact strings, example foo and bar, with OR the syntax goes like ^(foo|bar)$
by (3.1k points)
"xyz. com/checkout_(finalize_mc|with_pay_token)$" Are you sure you need contains? Where are the variables? At the end? If so then "xyz. com/checkout_(finalize_mc|with_pay_token). *$"
by (3.1k points)
@luedtke42 if trailing backslash isn't always inserted sounds like a URL structure problem. Magento has this issue. Fixable by htaccess directives so the trailing backslash is always added. Better for SEO too so you avoid duplicate URLs that have with and without trailing backslash
by (3.1k points)
@luedtke42 this is not "contains" this is trailing backslash with or without. "xyz. com/checkout_(finalize_mc|with_pay_token)/? $"
by (6.7k points)
Thanks Joel
by (3.1k points)
@luedtke42 no problem. Test it out first. Depending on platform there are nuances with REGEX syntax
+1 vote
by (3.1k points)
Are those exact strings or did you mean with a token variable?  
0 votes
by (3.1k points)
^checkout_. +$ Why not anchor it to checkout_?  
by (6.7k points)
Main reason is that there are other checkout steps (i. e. review_order, etc) that don't indicate a true purchase.  
The Google AdWords Group is where you can always find questions, answers, advice, reviews & recommendations from other community members about successful search engine marketing (SEM) ads through Google AdWords.

Related questions

...