- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
URL targeting and making query param targeting case insensitive
URL targeting and making query param targeting case insensitive
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hi,
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!
-Thanks
Re: URL targeting and making query param targeting case insensitive
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hi Naveen,
This is a great question ! You are right about, creating condtion for each case is certainly not optimal. if you want to make the parameter case insensitive, you will have to write a custom javascript for it. It should look something like this:
// 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 !
Best,
Shaunak Mali
Solutions Architect | Optimizely
Re: URL targeting and making query param targeting case insensitive
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
This satisfies our current experiment condition. Marking this as a solution.
Re: URL targeting and making query param targeting case insensitive
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
An alternative would be to use:
[A-Za-z]+
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 :
(?i)
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
sehly@rentpath.com
'The single biggest problem with communication is the illusion that it has taken place.' - George Bernard Shaw