Zope Hints
A/B-Split-Test
Here is what you need to do to hand out two versions of a page (typically a folder with the default index_html method). We are using a cookie which we call "split_test". Here is how you render one of two versions of the same page with the following index_html DTML Method (index_b being the default version):
<dtml-if expr="REQUEST.has_key('split_test') and REQUEST.split_test =='a'"> <dtml-var index_a> <dtml-else> <dtml-var index_b> </dtml-if>
The cookie can be set according to whatever criterion that the A/B-Test
is intended for. One of the simplest ways is to let the viewer choose
by calling the following
# Import a standard function, and get the HTML request and response objects. from Products.PythonScripts.standard import html_quote request = container.REQUEST RESPONSE = request.RESPONSE RESPONSE.setCookie('split_test', 'a', path='/', max_age=30*24*3600) RESPONSE.redirect('.') return ''
Switching back to 'b' is analogous.