Rich-text Reply

URL targeting and making query param targeting case insensitive

naveenjm 07-21-14

URL targeting and making query param targeting case insensitive

[ Edited ]

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

Level 1

Shaunak 07-21-14
 

Re: URL targeting and making query param targeting case insensitive

[ Edited ]

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 

Optimizely
naveenjm 07-24-14
 

Re: URL targeting and making query param targeting case insensitive

Shaunak, thanks for your reply!

This satisfies our current experiment condition. Marking this as a solution.
Level 1
cubelodyte 08-28-14
 

Re: URL targeting and making query param targeting case insensitive

[ Edited ]

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.

Scott Ehly
Manager of Site Optimization
sehly@rentpath.com

'The single biggest problem with communication is the illusion that it has taken place.' - George Bernard Shaw