0 Likes

Testing on an iFrame Element

Status: New
by Level 13 ‎12-07-2015 December 7, 2015

I've had a few requests now to test things within an iFrame element (e.g. social sharing buttons, video player assets, etc.). It'd be great if there was a way to access iFrame elements, and test them, or have a way to overlay those elements so that designs could be manipulated for them.

Level 13

Comments
by JDahlinANF
‎12-08-2015 December 8, 2015 - edited ‎12-08-2015 December 8, 2015

Include your Optimizely snippet inside the iFrame and you will be able to edit them (based on the URL targeting of the source of the iFrame).  This may mean that you need to have your experiment modify the iFrame's source to have a unique URL param so that the contents of that iFrame are only modified from within your current experiment.

 

e,.g.

Experiment "123" is for URL something.com/frame_holder

 

Variation A of this experiment modifies the source of the iFrame from

something.com/frame_content to

something.com/frame_contents?OptE=123&OptV=A

 

Variation B of this experiment modifies the source of the iFrame from

something.com/frame_content to

something.com/frame_contents?OptE=123&OptV=B

 

Now set up an experiment that targets

something.com/frame_contents?OptE=123

Set traffic at 100% to only 1 variation

In your "edit code" block, add the code that manipulates the framed contents based on the value of OptV

 

As long as youuse the same optimizely snippet in both pages, any success metrics  (button clicks, etc.) on the modified page will show up as results for experiment 123.

 

Level 2
by Level 13
‎12-08-2015 December 8, 2015

Only issue with that is that it's not enabled me to edit the actual elements within the iFrame (e.g. testing background images within the Ooyala player).

Level 13
by JDahlinANF
‎12-08-2015 December 8, 2015

@robertchan - I updated my post as you replied.  See if that helps.

If you are wanting to access the contents of the iFrame from the parent page, you'll have to take a ride in Doc Brown's DeLorean.

Level 2
by Level 13
‎12-08-2015 December 8, 2015

Haha, cheers and appreciate the update.

Level 13