複数のABテストを同時に行う多変量テストを hacker-friendly な記法で簡単に実装できる gem を開発中。
下記のように記述できる。
home/index.html.erb
...
<div class="landing-image">
<% # The first test %>
<%= select_variation(:landing_page, :btn_color, "red_btn", "green_btn", "blue_btn") do |alt| %>
<% # alt will be "red", "green" or "blue" %>
<%= link_to next_page_path, "Next", :class => alt %>
<% end %>
</div>
...
<div class="content">
...
<% # And the second one. You can also change what template is rendered by doing like this. %>
<%= select_variation(:landing_page, :explanation, "alts/explain1", "alts/explain2") do |alt| %>
<%= render :partial => alt %>
<% end %>
...
<% # You can put as many ab tests as you want in one page! %>
<%= link_to select_variation(:landing_page, :signup, "Learn more", "Sign up"), signup_path %>
<% # This is the same as the code below. %>
<% # select_variation(:landing_page, :signup, "Learn more", "Sign up") do |alt| %>
<% # link_to alt, signup_path %>
<% # end %>
...
</div>
...