I want to exclude pages with the same substring
My website has product pages that fall in to four very different categories. The site's structures gives these products the same substring in thier urls.
To better target my testing I want to figure out a way to exclude the different product categories so that when I test one the other three will not be affected.
The pages' code contains information that notes which category the pages fall into. I would like to know if there is a way optimizley can use this to help me exclude certain pages.
Just to make sure I'm understanding you right, you want to target only certian categories on your page, but the URL targeting does not allow you to differntiate the different products since they have the same substring. Correct?
In your case, I'd recommend using custom tags (see here:https://help.optimizely.com/hc/en-us/articles/2018
Typically, using code that already exists on the page doesn't work for targeting because the Optimizely snippet executes before this code is actually loaded onto the page, so Optimizely can't determine if it is or is not present. The custom tag (linked above) is added above the snippet so Optimizely can access the values.
Here are another couple discussions you might want to reference:
Depending on your service contract, "Conditional Activation Mode Configuration (Enterprise plans)" may be an option too!
(the condition being that the element that indicates it is of the category you are looking for exists on the page (e.g., window.$('.categoryTypehere').length > 0)