Regex targeting setting - "exculde almost everything in a directory but 2 pages in it are included"
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?
Solved! Go to Solution.
(anything) sample.com (anything) / (test_a or test_b) (anything)
@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:
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/test_e -- there're lot of directories in campaign
INCLUDE : http://sample.com/campaign/test_a
INCLUDE : http://sample.com/campaign/test_b
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)