saucy-kiss 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
- 0.2.3
1
+ 0.2.4
2
2
 
3
- Use snogmetrics 0.1.9, fix to correctly use KM JS property syntax.
3
+ Fix file list in gemspec.
4
+
5
+ 0.2.3 (not on Gemcutter)
6
+
7
+ Added events:
8
+ * Viewed Plan List (called by Saucy's PlansController)
9
+ * Activated
4
10
 
5
11
  0.2.2
6
12
 
@@ -1,11 +1,11 @@
1
- = saucy-kiss
1
+ # saucy-kiss
2
2
 
3
3
  Saucy-kiss is an extension to the Saucy gem for tracking your SaaS events
4
4
  in KISSmetrics.
5
5
 
6
- It depends on the unofficial KISSmetrics gem http://rubygems.org/gems/kissmetrics
6
+ It depends on [the unofficial KISSmetrics gem](http://rubygems.org/gems/kissmetrics).
7
7
 
8
- == Features and assumptions
8
+ ## Features and assumptions
9
9
 
10
10
  We assume that:
11
11
 
@@ -16,22 +16,28 @@ We assume that:
16
16
  advantage of KISSmetrics' anonymous identity tracking, automatic handling
17
17
  of the "Visited Site" metric, bot/crawler blacklisting, etc.
18
18
 
19
- == Supported events
19
+ ## Supported events
20
20
 
21
- Saucy-kiss records all the KISSmetrics SaaS events http://support.kissmetrics.com/apis/saas_events:
21
+ Saucy-kiss records all the [KISSmetrics SaaS events](http://support.kissmetrics.com/apis/saas_events):
22
22
 
23
23
  * Visited Site (handled automatically by the KISSmetrics JS library)
24
24
  * Signed Up
25
- * Upgraded / Downgraded (distinguised by plan price)
25
+ * Upgraded / Downgraded (distinguished by plan price)
26
26
  * Billed
27
27
  * Canceled
28
+ * Activated
29
+ * Called the first time that account.activated is set to true. It should be set once you are providing value to the user, so
30
+ for Trajectory this might be when the user creates their first story, while
31
+ for Copycopter an account might be activated once the user is syncing data to the client.
32
+ * Viewed Plan (plan_viewed)
33
+ * Viewed Plan List (plan_list_viewed)
34
+ * Called by Saucy's PlansController
28
35
 
29
- == Future work
36
+
37
+ ## Future work
30
38
 
31
39
  TODO: Additional events provided by Saucy:
32
40
 
33
- * Viewed Plan List
34
- * Viewed Plan
35
41
  * Invited New User
36
42
  * Accepted Invite
37
43
  * Tried to Exceed Project Limit
@@ -43,28 +49,28 @@ TODO: And events provided by Clearance:
43
49
 
44
50
  TODO: Examples of additional meta-events?:
45
51
 
46
- * Give example of Visit Retention (>1 signins per month with a Visit model and Clearance instrumentation)
52
+ * Give example of Visit Retention (> 1 signins per month with a Visit model and Clearance instrumentation)
47
53
 
48
- == Identity
54
+ ## Identity
49
55
 
50
- It will identify users to the current account where ever possible, and as anonymous
51
- otherwise. KISSmetrics will correctly handling aliasing between anonymous and
56
+ It will identify users to the current account wherever possible, and as anonymous
57
+ otherwise. KISSmetrics will correctly handle aliasing between anonymous and
52
58
  named identities, and distinguishing between successive named identites, such as
53
- when you switch accounts. For more information, see:
59
+ when you switch accounts. For more information, see:
54
60
 
55
61
  http://support.kissmetrics.com/advanced/identity-management
56
62
 
57
- == Installation
63
+ ## Installation
58
64
 
59
65
  In your Gemfile:
60
66
 
61
- gem "saucy-kiss"
67
+ gem "saucy-kiss"
62
68
 
63
69
  Then:
64
70
 
65
- $ bundle
71
+ $ bundle
66
72
 
67
- == Implementation in your application
73
+ ## Implementation in your application
68
74
 
69
75
  Add an initializer in config/initializers/saucy_kiss.rb:
70
76
 
@@ -86,30 +92,19 @@ Emit KISSmetrics javascript into your view (note the %== or equivalent #html_saf
86
92
  The KISSmetrics javascript is asynchronous, so it's safe to load at the top of
87
93
  your page.
88
94
 
89
- Configure Snogmetrics separately in config/initializers/snogmetrics.rb:
90
- (eventually this should be handled by saucy-kiss automatically)
91
-
92
- module Snogmetrics
93
- def output_strategy
94
- case Rails.env.to_s
95
- when 'development'
96
- :console_log
97
- when 'test'
98
- :array
99
- else
100
- :live
101
- end
102
- end
95
+ Note: Saucy::Kiss will automatically instantiate the Snogmetrics gem like this:
103
96
 
104
- def kissmetrics_api_key
105
- {
106
- 'staging' => 'abc123',
107
- 'production' => 'def456'
108
- }[Rails.env]
109
- end
110
- end
97
+ api_key = Saucy::Kiss::API_KEYS[Rails.env]
98
+ session = data[:request].session
99
+ Snogmetrics::KissmetricsApi.new(api_key, session, snogmetrics_output_strategy)
100
+ # snogmetrics_output_strategy returns :console_log in development, :array in test, and
101
+ # :live otherwise.
102
+
103
+ and the Kissmetrics gem like this:
111
104
 
112
- == Customization
105
+ Kissmetrics::HttpClient.new(Saucy::Kiss::API_KEYS[Rails.env])
106
+
107
+ ## Customization
113
108
 
114
109
  You may like to customize the events delivered to KISSmetrics. For example,
115
110
  you may want to track the referring ad campaign in a Signed Up event.
@@ -129,13 +124,13 @@ create a subclass of the observer and register it instead:
129
124
  end
130
125
 
131
126
  Rails.configuration.after_initialize do
132
- Saucy::Notifications.register_observer(M)yAppObserver.new({
127
+ Saucy::Notifications.register_observer(MyAppObserver.new({
133
128
  'staging' => 'abc123',
134
129
  'production' => 'def456'
135
130
  }[Rails.env]))
136
131
  end
137
132
 
138
- == How it works
133
+ ## How it works
139
134
 
140
135
  Saucy accepts observers in its configuration and publishes events for the
141
136
  SaaS events it implements. This gem implements an observer for these events,
@@ -152,7 +147,7 @@ and rendering them into your view as JS calls, similar to the Rails flash.
152
147
  Using the kissmetrics gem, we record to the KISSmetrics HTTP API from outside the
153
148
  request/response cycle (think billing callbacks, or queued operations) delivered directly.
154
149
 
155
- == Contributing to saucy-kiss
150
+ ## Contributing to saucy-kiss
156
151
 
157
152
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
158
153
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
@@ -162,8 +157,7 @@ request/response cycle (think billing callbacks, or queued operations) delivered
162
157
  * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
163
158
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
164
159
 
165
- == Copyright
160
+ ## Copyright
166
161
 
167
162
  Copyright (c) 2011 Jason Morrison. See LICENSE.txt for
168
163
  further details.
169
-
@@ -16,6 +16,10 @@ module Saucy
16
16
  })
17
17
  end
18
18
 
19
+ def plan_list_viewed(data)
20
+ javascript_client(data).record('Viewed Plan List')
21
+ end
22
+
19
23
  def account_created(data)
20
24
  javascript_client(data).record('Signed Up', {
21
25
  'Plan Name' => data[:account].plan.name,
@@ -43,8 +47,7 @@ module Saucy
43
47
  end
44
48
 
45
49
  def billed(data)
46
- account_identifier = "account-#{data[:account].id}"
47
- http_client.record(account_identifier, 'Billed', {
50
+ http_client.record(account_identifier(data), 'Billed', {
48
51
  'Billing Description' => "Monthly billing for #{data[:account].plan.name} plan",
49
52
  'Billing Amount' => data[:account].plan.price
50
53
  })
@@ -59,6 +62,15 @@ module Saucy
59
62
  })
60
63
  end
61
64
 
65
+ def activated(data)
66
+ plan = data[:account].plan
67
+ http_client.record(account_identifier(data), 'Activated', {
68
+ 'Plan Name' => plan.name,
69
+ 'Plan Price' => plan.price,
70
+ 'Is Trial Plan?'=> plan.trial
71
+ })
72
+ end
73
+
62
74
  private
63
75
 
64
76
  def javascript_client(data)
@@ -76,6 +88,10 @@ module Saucy
76
88
  end
77
89
  end
78
90
 
91
+ def account_identifier(data)
92
+ "account-#{data[:account].id}"
93
+ end
94
+
79
95
  def http_client
80
96
  Kissmetrics::HttpClient.new(@api_key)
81
97
  end
@@ -70,6 +70,13 @@ describe Saucy::Kiss::Observer do
70
70
  subject.plan_viewed(:request => request, :plan => small_plan)
71
71
  end
72
72
 
73
+ it "records a Viewed Plan List event through the KISSmetrics JS API for #plan_list_viewed" do
74
+ javascript_client.should_receive(:record).
75
+ with('Viewed Plan List')
76
+
77
+ subject.plan_list_viewed(:request => request, :account => account)
78
+ end
79
+
73
80
  it "records a Signed Up event through the KISSmetrics JS API for #account_created" do
74
81
  javascript_client.should_receive(:record).
75
82
  with('Signed Up', { 'Plan Name' => 'Small', 'Plan Price' => 10, 'Is Trial Plan?' => false })
@@ -109,4 +116,15 @@ describe Saucy::Kiss::Observer do
109
116
 
110
117
  subject.canceled(:request => request, :account => account)
111
118
  end
119
+
120
+ it "records an Activated event through the KISSmetrics HTTP API for #activated" do
121
+ Kissmetrics::HttpClient.should_receive(:new).
122
+ with('abc123')
123
+
124
+ account_identity = "account-#{account.id}"
125
+ http_client.should_receive(:record).
126
+ with(account_identity, 'Activated', { 'Plan Name' => 'Small', 'Plan Price' => 10, 'Is Trial Plan?' => false })
127
+
128
+ subject.activated(:request => request, :account => account)
129
+ end
112
130
  end
metadata CHANGED
@@ -1,128 +1,124 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: saucy-kiss
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.4
4
5
  prerelease:
5
- version: 0.2.3
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Jason Morrison
9
9
  - Ben Orenstein
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
-
14
- date: 2011-06-27 00:00:00 -04:00
15
- default_executable:
16
- dependencies:
17
- - !ruby/object:Gem::Dependency
13
+ date: 2011-06-27 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
18
16
  name: rspec
19
- prerelease: false
20
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &2152828000 !ruby/object:Gem::Requirement
21
18
  none: false
22
- requirements:
19
+ requirements:
23
20
  - - ~>
24
- - !ruby/object:Gem::Version
21
+ - !ruby/object:Gem::Version
25
22
  version: 2.3.0
26
23
  type: :development
27
- version_requirements: *id001
28
- - !ruby/object:Gem::Dependency
29
- name: yard
30
24
  prerelease: false
31
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *2152828000
26
+ - !ruby/object:Gem::Dependency
27
+ name: yard
28
+ requirement: &2152824980 !ruby/object:Gem::Requirement
32
29
  none: false
33
- requirements:
30
+ requirements:
34
31
  - - ~>
35
- - !ruby/object:Gem::Version
32
+ - !ruby/object:Gem::Version
36
33
  version: 0.6.0
37
34
  type: :development
38
- version_requirements: *id002
39
- - !ruby/object:Gem::Dependency
40
- name: bundler
41
35
  prerelease: false
42
- requirement: &id003 !ruby/object:Gem::Requirement
36
+ version_requirements: *2152824980
37
+ - !ruby/object:Gem::Dependency
38
+ name: bundler
39
+ requirement: &2152822880 !ruby/object:Gem::Requirement
43
40
  none: false
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
47
44
  version: 1.0.0
48
45
  type: :development
49
- version_requirements: *id003
50
- - !ruby/object:Gem::Dependency
51
- name: jeweler
52
46
  prerelease: false
53
- requirement: &id004 !ruby/object:Gem::Requirement
47
+ version_requirements: *2152822880
48
+ - !ruby/object:Gem::Dependency
49
+ name: jeweler
50
+ requirement: &2152821420 !ruby/object:Gem::Requirement
54
51
  none: false
55
- requirements:
52
+ requirements:
56
53
  - - ~>
57
- - !ruby/object:Gem::Version
54
+ - !ruby/object:Gem::Version
58
55
  version: 1.6.2
59
56
  type: :development
60
- version_requirements: *id004
61
- - !ruby/object:Gem::Dependency
62
- name: rcov
63
57
  prerelease: false
64
- requirement: &id005 !ruby/object:Gem::Requirement
58
+ version_requirements: *2152821420
59
+ - !ruby/object:Gem::Dependency
60
+ name: rcov
61
+ requirement: &2152819820 !ruby/object:Gem::Requirement
65
62
  none: false
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: "0"
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
70
67
  type: :development
71
- version_requirements: *id005
72
- - !ruby/object:Gem::Dependency
73
- name: activesupport
74
68
  prerelease: false
75
- requirement: &id006 !ruby/object:Gem::Requirement
69
+ version_requirements: *2152819820
70
+ - !ruby/object:Gem::Dependency
71
+ name: activesupport
72
+ requirement: &2152818800 !ruby/object:Gem::Requirement
76
73
  none: false
77
- requirements:
74
+ requirements:
78
75
  - - ~>
79
- - !ruby/object:Gem::Version
80
- version: "3.0"
76
+ - !ruby/object:Gem::Version
77
+ version: '3.0'
81
78
  type: :development
82
- version_requirements: *id006
83
- - !ruby/object:Gem::Dependency
84
- name: kissmetrics
85
79
  prerelease: false
86
- requirement: &id007 !ruby/object:Gem::Requirement
80
+ version_requirements: *2152818800
81
+ - !ruby/object:Gem::Dependency
82
+ name: kissmetrics
83
+ requirement: &2152816040 !ruby/object:Gem::Requirement
87
84
  none: false
88
- requirements:
85
+ requirements:
89
86
  - - ~>
90
- - !ruby/object:Gem::Version
87
+ - !ruby/object:Gem::Version
91
88
  version: 1.0.2
92
89
  type: :runtime
93
- version_requirements: *id007
94
- - !ruby/object:Gem::Dependency
95
- name: snogmetrics
96
90
  prerelease: false
97
- requirement: &id008 !ruby/object:Gem::Requirement
91
+ version_requirements: *2152816040
92
+ - !ruby/object:Gem::Dependency
93
+ name: snogmetrics
94
+ requirement: &2152812600 !ruby/object:Gem::Requirement
98
95
  none: false
99
- requirements:
96
+ requirements:
100
97
  - - ~>
101
- - !ruby/object:Gem::Version
102
- version: 0.1.9
98
+ - !ruby/object:Gem::Version
99
+ version: 0.1.8
103
100
  type: :runtime
104
- version_requirements: *id008
105
- - !ruby/object:Gem::Dependency
106
- name: saucy
107
101
  prerelease: false
108
- requirement: &id009 !ruby/object:Gem::Requirement
102
+ version_requirements: *2152812600
103
+ - !ruby/object:Gem::Dependency
104
+ name: saucy
105
+ requirement: &2152808420 !ruby/object:Gem::Requirement
109
106
  none: false
110
- requirements:
107
+ requirements:
111
108
  - - ~>
112
- - !ruby/object:Gem::Version
109
+ - !ruby/object:Gem::Version
113
110
  version: 0.10.0
114
111
  type: :runtime
115
- version_requirements: *id009
112
+ prerelease: false
113
+ version_requirements: *2152808420
116
114
  description: Record Saucy SaaS events to KISSmetrics
117
115
  email: jason.p.morrison@gmail.com
118
116
  executables: []
119
-
120
117
  extensions: []
121
-
122
- extra_rdoc_files:
118
+ extra_rdoc_files:
123
119
  - LICENSE.txt
124
- - README.rdoc
125
- files:
120
+ - README.md
121
+ files:
126
122
  - lib/saucy/kiss/controller_filters.rb
127
123
  - lib/saucy/kiss/observer.rb
128
124
  - lib/saucy-kiss.rb
@@ -132,36 +128,32 @@ files:
132
128
  - spec/support/rails_env.rb
133
129
  - Gemfile
134
130
  - LICENSE.txt
135
- - README.rdoc
131
+ - README.md
136
132
  - CHANGELOG.md
137
133
  - Rakefile
138
- has_rdoc: true
139
134
  homepage: http://github.com/jasonm/saucy-kiss
140
- licenses:
135
+ licenses:
141
136
  - MIT
142
137
  post_install_message:
143
138
  rdoc_options: []
144
-
145
- require_paths:
139
+ require_paths:
146
140
  - lib
147
- required_ruby_version: !ruby/object:Gem::Requirement
141
+ required_ruby_version: !ruby/object:Gem::Requirement
148
142
  none: false
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: "0"
153
- required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ! '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
148
  none: false
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- version: "0"
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
159
153
  requirements: []
160
-
161
154
  rubyforge_project:
162
- rubygems_version: 1.6.2
155
+ rubygems_version: 1.8.8
163
156
  signing_key:
164
157
  specification_version: 3
165
158
  summary: Record Saucy SaaS events to KISSmetrics
166
159
  test_files: []
167
-