URL targeting and making query param targeting case insensitive
I am looking for way to make targeting query param to be case insensitive.
E.g. Target URL : http://www.google.com
When Query param doesn't contain "test" OR "data"
This fails when we pass query param as "Test" OR "TEST" or other combination of cases. Is there a way to make it case incensitive?
I can think of adding all combinations of query param, but tht's not a optimal solution.
Appreciate your resonses!
// Step 1 : Get all the parameters using window.location.search var param = window.location.search; // Step 2: Convert them to lower case using toLowerCase() var l_param = param.toLowerCase(); // Step 3: parse though the string to check for parameter values using param.match(/*your_condtion_here*/)
This is one way of getting around it, let me know if this works for you !
Solutions Architect | Optimizely
This satisfies our current experiment condition. Marking this as a solution.
An alternative would be to use:
in your RegEx anywhere you want to have case insensitive text in your URL targeting.
I'm a little surprised this is necessary. I have a vague memory of this being an issue with our site over a year ago because my tendancy was to put :
at the front of our URL RegEx to make the entire string case insensitive. It had been my impression, at the time, that Optimizely was case insensitive by default. I'd be curious to know if that is true and the default behavior has changed.
Regardless, the "?i" doesn't work in the web interface, but the code with the character ranges does.
Manager of Site Optimization
'The single biggest problem with communication is the illusion that it has taken place.' - George Bernard Shaw