Rich-text Reply

Can you use regex for dimension value in audience?

WhatsAGorski 08-18-16

Can you use regex for dimension value in audience?

I was wondering if it was possible to use regex in the value field when using a custom dimension to target an audience.

 

I have been reading the docs and forums and I haven't been able to figure out if this is possible.

 

Does anybody know? This has implications to how I set up my dimensions and set the values in my code.

 

Thanks!

Test it!

Re: Can you use regex for dimension value in audience?

[ Edited ]

Little followup here for anyone who runs across this in a search:

I did some testing using the REST API and an empty experiment to try to figure this out.

I set up an audience using a custom dimension and made the value match string a regular expression (/.*test.*/ if you were wondering). I created my empty experiment and added the audience, making sure that my dimension string was set before pushing 'activate' to Optimizely.

To test whether this worked, I checked optimizely.data.visitor.audiences in the javascript console to see if I had been put into the audience or not.

Unfortunately it appears that you cannot do a regex match on a custom dimension string when creating an audience Smiley Sad

Would be a great feature, though!

Test it!