Rich-text Reply

Regex targeting setting - "exculde almost everything in a directory but 2 pages in it are included"

Tammy 06-17-15
Accepted Solution

Regex targeting setting - "exculde almost everything in a directory but 2 pages in it are included"

Hello

 

My question is about regex targeting in targeting panel.

I want to express "[ A ], exclude [A/B], but include [A/B/C]", let me explain.

 

Now I am trying to do regex targeting.

Then the thing I want to do is below,

 

1. Target http://sample.com.*

2. Exculde http://sample.com/campaign.*

3. But want to include only http://sample.com/campaign/test_a/ and http://sample.com/campaign/test_b/

 

Now I am struggling to set up this condition in the Optimizely's URL targeting panel.

It seems like Optimizely's regex can't use "!", "?!" then now I don't think up good way to express "NOT http://sample.com/campaign.* BUT http://sample.com/campaign/test_a/ and http://sample.com/campaign/test_b/"

 

The website has a tons of directrories so I would like to avoid targeting each directory each by each if it's possible.

 

Could you please advise me good way?

 

Thank you!

Tamie

 

Tamie
Level 6

JDahlinANF 06-17-15
 

Re: Regex targeting setting - "exculde almost everything in a directory but 2 pages in it are i

How about:

 

.*sample\.com.*\/(test_a|test_b).*

(anything) sample.com (anything) / (test_a or test_b) (anything)

brianlang 06-17-15
 

Re: Regex targeting setting - "exculde almost everything in a directory but 2 pages in it are i

@nap0leon solution will work based on your original requirements, but if you want to limit matched URL's so that anything after /test_a/ or /test_b/ (such as query string parameters) is excluded you could use this:

.*sample\.com/campaign/test_[ab]/$
Brian Lang
twitter.com/cometrico
Tammy 06-19-15
 

Re: Regex targeting setting - "exculde almost everything in a directory but 2 pages in it are i

@brianlang、@nap0leon,

 

Thank you for trying to help me! I really appreciate you guys!
But it seems I should apologize that I couldn't explain about my issue well.

 

I could includecampaign/test_a/ andcampaign/test_b/.

but I can't exclude the rest of directories under campaign.

 

INCLUDE : http://sample.com
INCLUDE : http://sample.com/aaa
INCLUDE : http://sample.com/bbb -- there're lot of directories underhttp://sample.com/
EXCLUDE :http://sample.com/campaign
EXCLUDE :http://sample.com/campaign/test_c
EXCLUDE :http://sample.com/campaign/test_d
EXCLUDE :http://sample.com/campaign/test_e -- there're lot of directories in campaign
INCLUDE : http://sample.com/campaign/test_a
INCLUDE : http://sample.com/campaign/test_b

umm...

Tamie
a1.png
Level 6
JDahlinANF 06-19-15
 

Re: Regex targeting setting - "exculde almost everything in a directory but 2 pages in it are i

So you want the experiment to run on all pages except a subset of pages in the /campaign directory?

 

There may be a better way of doing this, but you can set it up like a multi-page experiment.

For the first "page", use URL targeting that is "every page of the site excluding /campaign".

For the second "page", use URL taggeting that is "only campaign/test_a and campaign/test_b".

 

You will want to run the same code in the "B" variation for each page, so kind of a PITA there, but this handles the URL targeting issue. (see attached)

 

campaign_urls.png

Tammy 06-26-15
 

Re: Regex targeting setting - "exculde almost everything in a directory but 2 pages in it are i

Hello @nap0leon

 

Thank you for the solution!  And sorry for my late response.

It looks great, I couldn't think up to use multi-page experiment for this... thank you!

I'll try to do this!Smiley Happy

Tamie
Level 6