Only run experiment on page which has a specific text
I want to run an experiment on URLs which contain specific text in a specific place. For example, all our articles appear on site.com/article/1234 . I only want the experiment to run on articles written by a specific author. Each of those URLs has the author's name in the "By: Author Name" line near the title.
Is this possible?
This sounds like a good case for using one of two options: custom tags OR conditional activation.
Using Custom Tags (recommended):
Tag those pages that have the specific author, then target those via your Audience settings.
Using Conditional Activation (advanced):
What you would do is fire an event when your text appears on the page (ideally this would happen in the <head> - do you have some meta data about who the author is there?). The experiment would be set to conditional activation and activate upon the firing of that event.
A potential downside to using conditional activation in this manner: if the event only fires once the page has started loading the body, you may experience a significant amount of FOOC.
Does that make sense?
One more question- if the element I want to target only appears 10% of the time on the pages on a specific URL, is there any downside in running the experiment on the whole URL even if it will only change the element/text 10% of the time? Will optimizely know when it's changing the text and when it couldn't find it?