Rich-text Reply

Hide/show button based on experiment.

OliverFoggin 05-26-16

Hide/show button based on experiment.

I'm used to A/B testing more in code than UI so I'm not sure what I'm doing wrong here.


I have serached around the knowledge base and around StackOverflow to no avail.


I'm setting up a first test experiment for my iOS app.


It currently has a standard Facebook "Log in with Facebook" button. But I'd like to add an experiment to change this to a "Log in" button that is more in keeping with the style of the app.


My initial approach was to create both buttons in a Storyboard and go into the expeirment editor to set each button to hidden based on the variant.


This seems to work once on the device but then on every subsequent run both buttons are visible.


Is there a guide or best practice when setting up UI experiments like this on Optimizely?



tedroddy 05-27-16

Re: Hide/show button based on experiment.


I would recommend setting up a boolean Live Variable for this experiment. In your ViewController, you can hide or show the button based on the value of the Live Variable. Then you can toggle the Facebook button on or off within the experiment and toggle the other login button on or off as well. I would not recommend setting this up as a visual edit — Live Variables really the way to go if you have access to the code.

Re: Hide/show button based on experiment.

Ah thanks very much.


So, do live variables have a default value?


I guess I'll have a look around to find out.