Skip to content

Instantly share code, notes, and snippets.

@nantekkotai
Created March 7, 2013 08:39
Show Gist options
  • Save nantekkotai/5106498 to your computer and use it in GitHub Desktop.
Save nantekkotai/5106498 to your computer and use it in GitHub Desktop.
【Railsで】Vanityのセットアップ【A/Bテスト】 ref: http://qiita.com/items/87a71c6d4a6fe971c2da
class ApplicationController < ActionController::Base
protect_from_forgery
use_vanity :current_user
protected
def current_user
session[:user_id]
end
end
# 以下を追加
Vanity.playground.collecting = true
gem 'vanity'
<!-- リンク部分のみ表示 -->
<a href="<%= new_post_path %>"><%= ab_test :post_labels %></a>
metric "Post" do
description "おお!おおおおお!!!"
end
ab_test "Post labels" do
description "投稿画面へのリンクテキストを比較"
alternatives '記事を投稿する', 'ブログを投稿する', 'つぶやく'
metrics :post
end
def new
@post = Post.new
# 以下の一行を追加
track! :post
# 以下を追加
match '/vanity(/:action(/:id(.:format)))', :controller=>:vanity
development:
adapter: redis
database: redis://localhost:6379/0
class VanityController < ApplicationController
include Vanity::Rails::Dashboard
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment