In my case feature that I want to A/B test is activated on the page only 1% of the time. So I don't want to load Optmizely JS always (for performance reason) and load it only when that particular feature is activated - does it sound like a right approach given mentioned circumstances?
In your particular case it would make sense to conditionally load the Optimizely JS file only when the content that you want to A/B test shows up on the page.
The key will be to make sure that you always load the file when that content is on the page, and additionally that you have a way to know which visitors saw the experiment so that you can load the Optimizely file on subsequent pages that you may want to use to track conversions. This should be relatively straightforward to do by just checking for the cookies that get set.
Thanks Ricky, this is helpful! However I have another related question.
The product that I'm going to test is a rich text editor. I want to see if there is higher conversion rate (of achieving certain goal) for people which were displayed certain welcome message (dialog). I want to display dialog once, but track how it affect performance in the longer term. I was planning on implementing logic of displaying dialog only once by myself (using totally custom, optimizely not realted cookie), but from what you wrote it seems that there might be a way to use optmizely for it, is that correct? (If so, could you provide some specifics?)
The way we normally work around this problem is by setting an additional cookie right in the variation code. For example if you write:
Then you can easily check for the presence of the saw_dialog cookie before showing it again.
In your case the code would look something like this:
1. Check for presence of saw_dialog cookie
2. If present do not show dialog, otherwise show dialog
3. If cookie is not already set, set the cookie
This way your code will only run once and set you up within Optimizely to make sure you don't run the visual changes multiple times for any user.
Let me know if that helps.