Using optimizely from within an iFrame in Safari
We want to use Optimizely to create experiments in our web app, which is used in an iFrame on other sites.
We've used Optimizely before in another web app and I'm aware that it relies on using cookies. However some browsers - especially Safari - don't allow setting cookies from within an iFrame.
Is there any solution to this issue? Is it possible in some way to use Optimizely in a web app hosted in an iFrame by another site?
While you won't be able to set cookies on the parent page from within the iFrame, you can certainly run Optimizely experiments on the iFrame itself. When testing different variations of an iFrame, you should think of the iFrame as its own HTML page, independent of the parent page that it's loaded on.
More information about how to set this up is in this knowledge base article. Hope this is helpful!
Sr. Technical Support Engineer
Optimizely | EMEA
Thanks you for your reply.
I understand how to run experiments on an iFrame.
My question is - isn't it required to set cookies in order to run experiments with Optimizely?
If so, isn't that a problem when using an iFrame? Since Safari for instance won't allow it.
To illustrate Klarna's point...
I create a new page on my localhost that uses an iFrame of my wife's website where I know that when I submit an Add To Cart event on her site, it places my ID into a cookie so that the page can be pre-filled with my ID next time I come back to that page.
Using this test page, with Chrome and FireFox, I totally see my ID in the field when I return to the page.
In Safari, however, the field remains blank because the cookie that stores my ID is not created.
The expectation then is that Safari users accessing a site that uses an iFrame where the framed site is using Optimizely, that the optimizelyBuckets cookie would not be created causing users to be randomly placed into different variations on each page hit.
Yes, exactly what I meant. Thanks @nap0leon.
I was also not sure if the only thing that would not work is the consistency part of not seeing the same variation. Optimizely sets several cookies, so maybe some other functionality would be broken.