Ab Testing Structure

Hi,

I am developing a website and the team wants to create inside our infrastructure an AB testing mechanism.

I started to work on this issue , but i am feeling i am missing some stuff.

I assume the AB testing for now will only be handling different views testing…

whats the best way to create this feature ?

  1. instead of running render , fire event "onRender". component catch this event will check if the client have a decision and render the page for him .

  2. override the render function with the decision making .

any better ideas for implementing this ?

you could probably use themes (as long as you do not use them for different purpose): http://www.yiiframework.com/doc/guide/1.1/en/topics.theming

in onBeforeRequest/onBeforeAction/etc handler place logic that will choose theme A or B and set Yii::app()->theme = $theme; then views used by render(), renderPartial() will try to use provided by the theme and if there is no such view - it will fall back to regular view in project directory structure.

Its a good idea to use the theming for the ab testing.

my only issue left is to which event to attach the logic, i want something before the render -> when the action already decided what view it will render.

some actions might have 2/3 different views they might render depending on the scenarion…

Try beforeRender of the controller: http://www.yiiframework.com/doc/api/1.1/CController#beforeRender-detail