mountain-goat 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. data/Gemfile +3 -0
  2. data/Gemfile.lock +31 -0
  3. data/History.md +4 -0
  4. data/LICENSE +20 -0
  5. data/POST_INSTALL +14 -0
  6. data/README.md +128 -0
  7. data/Rakefile +24 -0
  8. data/init.rb +4 -0
  9. data/install.rb +53 -0
  10. data/lib/mountain_goat/controllers/mountain_goat/mountain_goat_controller.rb +6 -0
  11. data/lib/mountain_goat/controllers/mountain_goat/mountain_goat_converts_controller.rb +107 -0
  12. data/lib/mountain_goat/controllers/mountain_goat/mountain_goat_metric_variants_controller.rb +80 -0
  13. data/lib/mountain_goat/controllers/mountain_goat/mountain_goat_metrics_controller.rb +108 -0
  14. data/lib/mountain_goat/controllers/mountain_goat/mountain_goat_rallies_controller.rb +3 -0
  15. data/lib/mountain_goat/metric_tracking.rb +241 -0
  16. data/lib/mountain_goat/models/ci_meta.rb +9 -0
  17. data/lib/mountain_goat/models/convert.rb +70 -0
  18. data/lib/mountain_goat/models/convert_meta_type.rb +19 -0
  19. data/lib/mountain_goat/models/cs_meta.rb +9 -0
  20. data/lib/mountain_goat/models/metric.rb +10 -0
  21. data/lib/mountain_goat/models/metric_variant.rb +22 -0
  22. data/lib/mountain_goat/models/rally.rb +32 -0
  23. data/lib/mountain_goat/switch_variant.rb +32 -0
  24. data/lib/mountain_goat/version.rb +3 -0
  25. data/lib/mountain_goat/views/mountain_goat/layouts/mountain_goat.html.erb +53 -0
  26. data/lib/mountain_goat/views/mountain_goat/mountain_goat_converts/_convert_form.html.erb +26 -0
  27. data/lib/mountain_goat/views/mountain_goat/mountain_goat_converts/_convert_meta_type_form.html.erb +27 -0
  28. data/lib/mountain_goat/views/mountain_goat/mountain_goat_converts/edit.html.erb +13 -0
  29. data/lib/mountain_goat/views/mountain_goat/mountain_goat_converts/index.html.erb +33 -0
  30. data/lib/mountain_goat/views/mountain_goat/mountain_goat_converts/new.html.erb +13 -0
  31. data/lib/mountain_goat/views/mountain_goat/mountain_goat_converts/show.html.erb +59 -0
  32. data/lib/mountain_goat/views/mountain_goat/mountain_goat_metric_variants/_metric_variant_form.html.erb +27 -0
  33. data/lib/mountain_goat/views/mountain_goat/mountain_goat_metric_variants/edit.html.erb +13 -0
  34. data/lib/mountain_goat/views/mountain_goat/mountain_goat_metric_variants/index.html.erb +35 -0
  35. data/lib/mountain_goat/views/mountain_goat/mountain_goat_metric_variants/new.html.erb +15 -0
  36. data/lib/mountain_goat/views/mountain_goat/mountain_goat_metric_variants/show.html.erb +14 -0
  37. data/lib/mountain_goat/views/mountain_goat/mountain_goat_metrics/_metric_form.html.erb +26 -0
  38. data/lib/mountain_goat/views/mountain_goat/mountain_goat_metrics/edit.html.erb +13 -0
  39. data/lib/mountain_goat/views/mountain_goat/mountain_goat_metrics/index.html.erb +29 -0
  40. data/lib/mountain_goat/views/mountain_goat/mountain_goat_metrics/new.html.erb +14 -0
  41. data/lib/mountain_goat/views/mountain_goat/mountain_goat_metrics/show.html.erb +59 -0
  42. data/lib/mountain_goat.rb +19 -0
  43. data/migrations/20090716093747_create_metric_tracking_tables.rb +85 -0
  44. data/mountain-goat.gemspec +26 -0
  45. metadata +141 -0
@@ -0,0 +1,14 @@
1
+
2
+
3
+ <div id="container-main" class="mt-metric-variants">
4
+ <div class="mountain-goat-panel cenetered">
5
+ <a href="<%= mountain_goat_converts_url %>">Goals</a> > <a href="<%= mountain_goat_convert_url :id => @metric_variant.metric.convert.id %>"><%=h @metric_variant.metric.convert.name %> Goal</a> > <a href="<%= mountain_goat_metric_url :id => @metric_variant.metric.id %>"><%=h @metric_variant.metric.title %></a>
6
+
7
+ <h2><%=h @metric_variant.name %></h2>
8
+
9
+ <div class="value"><%=h @metric_variant.value %></div>
10
+ <div class="serves-converts"><%=h @metric_variant.served %> / <%=h @metric_variant.conversions %> (<%=h number_to_percentage(@metric_variant.conversion_rate, :precision => 0) %>)</div>
11
+
12
+ <a href="<%= edit_mountain_goat_metric_variant_url :id => @metric_variant.id %>">Edit</a>
13
+ </div>
14
+ </div>
@@ -0,0 +1,26 @@
1
+ <%# locals => f %>
2
+
3
+ <%= f.hidden_field(:convert_id) %>
4
+
5
+ <% if f.object.new_record? %>
6
+ <div class="item metric-type">
7
+ <%= f.label :metric_type %>
8
+ <%= f.text_field :metric_type %>
9
+ </div>
10
+ <% else %>
11
+ <span class="metric-type"><%= f.object.metric_type %></span>
12
+ <% end %>
13
+
14
+ <div class="item title">
15
+ <%= f.label :title %>
16
+ <%= f.text_field :title %>
17
+ </div>
18
+
19
+ <div class="item tally-each-serve">
20
+ <%= f.check_box :tally_each_serve %>
21
+ <%= f.label :tally_each_serve, "Tally every hit (or just once per user)" %>
22
+ </div>
23
+
24
+ <div class="item submit">
25
+ <%= f.submit 'Submit' %>
26
+ </div>
@@ -0,0 +1,13 @@
1
+
2
+
3
+ <div id="container-main" class="mt-metrics">
4
+ <div class="mountain-goat-panel centered">
5
+ <h2>Editing metric</h2>
6
+
7
+ <% form_for :metric, @metric, :url => mountain_goat_metric_url(:id => @metric.id), :html => { :method => :put } do |f| %>
8
+ <%= f.error_messages %>
9
+
10
+ <%= render :partial => 'mountain_goat_metrics/metric_form', :locals => { :f => f } %>
11
+ <% end %>
12
+ </div>
13
+ </div>
@@ -0,0 +1,29 @@
1
+
2
+
3
+ <div id="container-main" class="mt-metrics">
4
+ <div class="mountain-goat-panel">
5
+ <h2>Listing metrics</h2>
6
+
7
+ <table>
8
+ <tr>
9
+ <th>Type</th>
10
+ <th>Title</th>
11
+ <th>Convert</th>
12
+ </tr>
13
+
14
+ <% @metrics.each do |metric| %>
15
+ <tr>
16
+ <td><%=h metric.metric_type %></td>
17
+ <td><%=h metric.title %></td>
18
+ <td><%=h metric.convert_id %></td>
19
+ <td><a href="<%= mountain_goat_metric_url metric %>">Details</a></td>
20
+ <td><a href="<%= edit_mountain_goat_metric_url(metric)%>">Edit</a></td>
21
+ </tr>
22
+ <% end %>
23
+ </table>
24
+
25
+ <br />
26
+
27
+ <a href="<%= new_mountain_goat_metric_url %>">New metric</a>
28
+ </div>
29
+ </div>
@@ -0,0 +1,14 @@
1
+
2
+
3
+ <div id="container-main" class="mt-metrics">
4
+ <div class="mountain-goat-panel cenetered">
5
+ <h2>New metric for <%=h @convert.name %></h2>
6
+
7
+ <% form_for :metric, @metric, :url => mountain_goat_metrics_url do |f| %>
8
+ <%= f.error_messages %>
9
+
10
+ <%= render :partial => 'mountain_goat_metrics/metric_form', :locals => { :f => f } %>
11
+ <% end %>
12
+
13
+ </div>
14
+ </div>
@@ -0,0 +1,59 @@
1
+
2
+ <% if !respond_to?(:chart) %>
3
+ <% def chart(*args); 'Please install Flotilla plugin (http://flotilla.rubyforge.org/) for charts'; end; %>
4
+ <% end %>
5
+
6
+ <div id="container-main" class="mt-metrics">
7
+ <div class="mountain-goat-panel cenetered">
8
+ <a href="<%= mountain_goat_converts_url %>">Goals</a> > <a href="<%= mountain_goat_convert_url :id => @metric.convert.id %>"><%=h @metric.convert.name %> Goal</a> > <span class="metric-type"><%=h @metric.metric_type %></span>
9
+
10
+ <h2><%=h @metric.title %></h2>
11
+
12
+ <div class="variants">
13
+ <% if @metric.metric_variants.count == 0 %>
14
+ <span class="none">No metric variants</span>
15
+ <% else %>
16
+ <div class="flyer-analysis countbar">
17
+ <div class="title">Conversion Rates</div>
18
+ <div class="graph">
19
+ <%= chart("analysis_graph#{@metric.id}",
20
+ { "Served" => { :collection => @rates[:served], :x => :variant_type, :y => :value },
21
+ "Conversions" => { :collection => @rates[:conversions], :x => :variant_type, :y => :value } },
22
+ { :xaxis => {:autoscaleMargin => 0.1, :ticks => @rates[:titles].map { |i,t| [i + 0.5, t] }.sort }, :yaxis => { :min => 0, :minTickSize => 1 }, :bars => { :show => true }, :legend => { :position => "ne" } }, :placeholder_size => "300x200") %>
23
+
24
+ </div>
25
+ <div class="graph">
26
+ <%= chart("analysis_conv_graph#{@metric.id}",
27
+ { "Conversion Rate (%)" => { :collection => @rates[:conversion_rates], :x => :variant_type, :y => :value } },
28
+ { :xaxis => {:autoscaleMargin => 0.1, :ticks => @rates[:titles].map { |i,t| [i + 0.5, t] }.sort }, :yaxis => { :min => 0, :minTickSize => 1 }, :bars => { :show => true }, :legend => { :position => "ne" } }, :placeholder_size => "300x200") %>
29
+
30
+ </div>
31
+ </div>
32
+ <% @metric.metric_variants.each do |mv| %>
33
+ <div class="metric-variant">
34
+ <div class="item name">
35
+ <span class="desc">Name</span>
36
+ <span class="val"><a href="<%= mountain_goat_metric_variant_url mv %>"><%= mv.name %></a> [<a href="<%= edit_mountain_goat_metric_variant_url :id => mv.id %>">Edit</a>]</span>
37
+ </div>
38
+
39
+ <div class="item value">
40
+ <span class="desc">Value</span>
41
+ <span class="val"><%= mv.value %></span>
42
+ </div>
43
+
44
+ <div class="item rate">
45
+ <span class="rates">Conversion:</span>
46
+ <span class="conversions"><%= mv.conversions %></span> /
47
+ <span class="served"><%= mv.served %></span>
48
+ (<span class="val"><%= number_to_percentage(mv.conversion_rate, :precision => 0) %></span>)
49
+ </div>
50
+ </div>
51
+
52
+ <% end %>
53
+ <% end %>
54
+ </div>
55
+
56
+ <a href="<%= edit_mountain_goat_metric_url :id => @metric %>">Edit Metric</a> |
57
+ <a href="<%= new_mountain_goat_metric_mountain_goat_metric_variant_url :mountain_goat_metric_id => @metric.id %>">New Variant</a>
58
+ </div>
59
+ </div>
@@ -0,0 +1,19 @@
1
+
2
+ require File.join([File.dirname(__FILE__), 'mountain_goat/controllers/mountain_goat/mountain_goat_controller'])
3
+ require File.join([File.dirname(__FILE__), 'mountain_goat/controllers/mountain_goat/mountain_goat_metrics_controller'])
4
+ require File.join([File.dirname(__FILE__), 'mountain_goat/controllers/mountain_goat/mountain_goat_metric_variants_controller'])
5
+ require File.join([File.dirname(__FILE__), 'mountain_goat/controllers/mountain_goat/mountain_goat_converts_controller'])
6
+ require File.join([File.dirname(__FILE__), 'mountain_goat/controllers/mountain_goat/mountain_goat_rallies_controller'])
7
+
8
+ require File.join([File.dirname(__FILE__), 'mountain_goat/metric_tracking'])
9
+ require File.join([File.dirname(__FILE__), 'mountain_goat/models/metric'])
10
+ require File.join([File.dirname(__FILE__), 'mountain_goat/models/metric_variant'])
11
+ require File.join([File.dirname(__FILE__), 'mountain_goat/models/convert'])
12
+ require File.join([File.dirname(__FILE__), 'mountain_goat/models/convert_meta_type'])
13
+ require File.join([File.dirname(__FILE__), 'mountain_goat/models/cs_meta'])
14
+ require File.join([File.dirname(__FILE__), 'mountain_goat/models/ci_meta'])
15
+ require File.join([File.dirname(__FILE__), 'mountain_goat/models/rally'])
16
+
17
+ module MountainGoat
18
+
19
+ end
@@ -0,0 +1,85 @@
1
+ class CreateMetricTrackingTables < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table "ci_metas", :force => true do |t|
5
+ t.integer "rally_id"
6
+ t.integer "convert_meta_type_id"
7
+ t.integer "data"
8
+ t.datetime "created_at"
9
+ t.datetime "updated_at"
10
+ end
11
+
12
+ add_index "ci_metas", ["convert_meta_type_id", "data"], :name => "ci_metas_cmt_data_index"
13
+ add_index "ci_metas", ["convert_meta_type_id"], :name => "ci_metas_cmt_index"
14
+ add_index "ci_metas", ["rally_id"], :name => "ci_metas_rally_index"
15
+
16
+ create_table "convert_meta_types", :force => true do |t|
17
+ t.integer "convert_id"
18
+ t.string "name"
19
+ t.string "var"
20
+ t.string "meta_type"
21
+ t.datetime "created_at"
22
+ t.datetime "updated_at"
23
+ end
24
+
25
+ create_table "converts", :force => true do |t|
26
+ t.string "convert_type"
27
+ t.datetime "created_at"
28
+ t.datetime "updated_at"
29
+ t.string "name"
30
+ end
31
+
32
+ create_table "cs_metas", :force => true do |t|
33
+ t.integer "rally_id"
34
+ t.integer "convert_meta_type_id"
35
+ t.string "data"
36
+ t.datetime "created_at"
37
+ t.datetime "updated_at"
38
+ end
39
+
40
+ add_index "cs_metas", ["convert_meta_type_id", "data"], :name => "cs_metas_cmt_data_index"
41
+ add_index "cs_metas", ["convert_meta_type_id"], :name => "cs_metas_cmt_index"
42
+ add_index "cs_metas", ["rally_id"], :name => "cs_metas_rally_index"
43
+
44
+ create_table "metric_variants", :force => true do |t|
45
+ t.integer "metric_id"
46
+ t.text "value"
47
+ t.text "opt1"
48
+ t.text "opt2"
49
+ t.integer "served", :default => 0
50
+ t.integer "conversions", :default => 0
51
+ t.datetime "created_at"
52
+ t.datetime "updated_at"
53
+ t.string "name"
54
+ t.float "priority", :default => 1.0, :null => false
55
+ t.string "switch_type"
56
+ end
57
+
58
+ create_table "metrics", :force => true do |t|
59
+ t.string "metric_type"
60
+ t.string "title"
61
+ t.datetime "created_at"
62
+ t.datetime "updated_at"
63
+ t.integer "convert_id"
64
+ t.boolean "tally_each_serve", :default => true
65
+ t.boolean "is_switch", :default => false
66
+ end
67
+
68
+ create_table "rallies", :force => true do |t|
69
+ t.integer "convert_id"
70
+ t.datetime "created_at"
71
+ t.datetime "updated_at"
72
+ end
73
+ end
74
+
75
+ def self.down
76
+ drop_table :ci_metas
77
+ drop_table :convert_meta_types
78
+ drop_table :converts
79
+ drop_table :cs_metas
80
+ drop_table :metric_variants
81
+ drop_table :metrics
82
+ drop_table :rallies
83
+ end
84
+
85
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "mountain_goat/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "mountain-goat"
7
+ s.version = MountainGoat::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Geoffrey Hayes", "drawn.to"]
10
+ s.email = ["geoff@drawn.to"]
11
+ s.homepage = "http://github.com/hayesgm/mountain-goat"
12
+ s.summary = "A/B Testing to the edge"
13
+ s.description = "A/B test everything and get awesome analytics"
14
+
15
+ s.rubyforge_project = "mountain-goat"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ # Developmnet Dependencies
23
+ s.add_development_dependency(%q<rspec>, ["~> 2.2.0"])
24
+ s.add_development_dependency(%q<rack-test>, [">= 0.5.6"])
25
+ end
26
+
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mountain-goat
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Geoffrey Hayes
14
+ - drawn.to
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2011-07-07 00:00:00 Z
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 2
32
+ - 2
33
+ - 0
34
+ version: 2.2.0
35
+ type: :development
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: rack-test
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 7
46
+ segments:
47
+ - 0
48
+ - 5
49
+ - 6
50
+ version: 0.5.6
51
+ type: :development
52
+ version_requirements: *id002
53
+ description: A/B test everything and get awesome analytics
54
+ email:
55
+ - geoff@drawn.to
56
+ executables: []
57
+
58
+ extensions: []
59
+
60
+ extra_rdoc_files: []
61
+
62
+ files:
63
+ - Gemfile
64
+ - Gemfile.lock
65
+ - History.md
66
+ - LICENSE
67
+ - POST_INSTALL
68
+ - README.md
69
+ - Rakefile
70
+ - init.rb
71
+ - install.rb
72
+ - lib/mountain_goat.rb
73
+ - lib/mountain_goat/controllers/mountain_goat/mountain_goat_controller.rb
74
+ - lib/mountain_goat/controllers/mountain_goat/mountain_goat_converts_controller.rb
75
+ - lib/mountain_goat/controllers/mountain_goat/mountain_goat_metric_variants_controller.rb
76
+ - lib/mountain_goat/controllers/mountain_goat/mountain_goat_metrics_controller.rb
77
+ - lib/mountain_goat/controllers/mountain_goat/mountain_goat_rallies_controller.rb
78
+ - lib/mountain_goat/metric_tracking.rb
79
+ - lib/mountain_goat/models/ci_meta.rb
80
+ - lib/mountain_goat/models/convert.rb
81
+ - lib/mountain_goat/models/convert_meta_type.rb
82
+ - lib/mountain_goat/models/cs_meta.rb
83
+ - lib/mountain_goat/models/metric.rb
84
+ - lib/mountain_goat/models/metric_variant.rb
85
+ - lib/mountain_goat/models/rally.rb
86
+ - lib/mountain_goat/switch_variant.rb
87
+ - lib/mountain_goat/version.rb
88
+ - lib/mountain_goat/views/mountain_goat/layouts/mountain_goat.html.erb
89
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_converts/_convert_form.html.erb
90
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_converts/_convert_meta_type_form.html.erb
91
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_converts/edit.html.erb
92
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_converts/index.html.erb
93
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_converts/new.html.erb
94
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_converts/show.html.erb
95
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_metric_variants/_metric_variant_form.html.erb
96
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_metric_variants/edit.html.erb
97
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_metric_variants/index.html.erb
98
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_metric_variants/new.html.erb
99
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_metric_variants/show.html.erb
100
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_metrics/_metric_form.html.erb
101
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_metrics/edit.html.erb
102
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_metrics/index.html.erb
103
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_metrics/new.html.erb
104
+ - lib/mountain_goat/views/mountain_goat/mountain_goat_metrics/show.html.erb
105
+ - migrations/20090716093747_create_metric_tracking_tables.rb
106
+ - mountain-goat.gemspec
107
+ homepage: http://github.com/hayesgm/mountain-goat
108
+ licenses: []
109
+
110
+ post_install_message:
111
+ rdoc_options: []
112
+
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ hash: 3
121
+ segments:
122
+ - 0
123
+ version: "0"
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ hash: 3
130
+ segments:
131
+ - 0
132
+ version: "0"
133
+ requirements: []
134
+
135
+ rubyforge_project: mountain-goat
136
+ rubygems_version: 1.8.5
137
+ signing_key:
138
+ specification_version: 3
139
+ summary: A/B Testing to the edge
140
+ test_files: []
141
+