impressionist 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,117 +1,122 @@
1
- = impressionist
1
+ ![Impressionist Logo](https://github.com/cowboycoded/impressionist/raw/master/logo.png)
2
2
 
3
- A lightweight plugin that logs impressions per action or manually per model
3
+ impressionist
4
+ =============
4
5
 
5
- == I would not call this a stable plugin yet, although I have been running it in prod with no problems. Use at your own risk ;-)
6
+ A lightweight plugin that logs impressions per action or manually per model
6
7
 
7
- == What does this thing do?
8
+ I would not call this a stable plugin yet, although I have been running it in prod with no problems. Use at your own risk ;-)
9
+ ------------------------------------------------------------------------------------------------------------------------------
8
10
 
11
+ What does this thing do?
12
+ ------------------------
9
13
  Logs an impression... and I use that term loosely. It can log page impressions (technically action impressions), but it is not limited to that.
10
14
  You can log impressions multiple times per request. And you can also attach it to a model. The goal of this project is to provide customizable
11
15
  stats that are immediately accessible in your application as opposed to using G Analytics and pulling data using their API. You can attach custom
12
16
  messages to impressions. No reporting yet.. this thingy just creates the data.
13
17
 
14
- == What about bots?
15
-
18
+ What about bots?
19
+ ----------------
16
20
  They are ignored. 1200 known bots have been added to the ignore list as of Feb 1, 2011. Impressionist uses this list:
17
21
  http://www.user-agents.org/allagents.xml
18
22
 
19
-
20
- == Which versions of Rails and Ruby is this compatible with?
21
-
23
+ Which versions of Rails and Ruby is this compatible with?
24
+ ---------------------------------------------------------
22
25
  Rails 3.0.4 and Ruby 1.9.2 (also tested on REE 1.8.7) - Sorry, but you need to upgrade if you are using Rails 2. You know you want to anyways.. all the cool kids are doing it ;-)
23
26
 
24
- == Installation
25
-
27
+ Installation
28
+ ------------
26
29
  Add it to your Gemfile
27
30
 
28
- gem 'impressionist'
31
+ gem 'impressionist'
29
32
 
30
33
  Install with Bundler
31
34
 
32
- bundle install
35
+ bundle install
33
36
 
34
37
  Generate the impressions table migration
35
38
 
36
- rails g impressionist
39
+ rails g impressionist
37
40
 
38
41
  Run the migration
39
42
 
40
- rake db:migrate
43
+ rake db:migrate
41
44
 
42
45
  The following fields are provided in the migration:
43
46
 
44
- t.string "impressionable_type" # model type: Widget
45
- t.integer "impressionable_id" # model instance ID: @widget.id
46
- t.integer "user_id" # automatically logs @current_user.id
47
- t.string "controller_name" # logs the controller name
48
- t.string "action_name" # logs the action_name
49
- t.string "view_name" # TODO: log individual views (as well as partials and nested partials)
50
- t.string "request_hash" # unique ID per request, in case you want to log multiple impressions and associate them together
51
- t.string "ip_address" # request.remote_ip
52
- t.string "message" # custom message you can add
53
- t.datetime "created_at" # I am not sure what this is.... Any clue?
54
- t.datetime "updated_at" # never seen this one before either.... Your guess is as good as mine??
55
-
56
- == Usage
57
-
47
+ t.string "impressionable_type" # model type: Widget
48
+ t.integer "impressionable_id" # model instance ID: @widget.id
49
+ t.integer "user_id" # automatically logs @current_user.id
50
+ t.string "controller_name" # logs the controller name
51
+ t.string "action_name" # logs the action_name
52
+ t.string "view_name" # TODO: log individual views (as well as partials and nested partials)
53
+ t.string "request_hash" # unique ID per request, in case you want to log multiple impressions and group them
54
+ t.string "session_hash" # logs the rails session
55
+ t.string "ip_address" # request.remote_ip
56
+ t.string "message" # custom message you can add
57
+ t.datetime "created_at" # I am not sure what this is.... Any clue?
58
+ t.datetime "updated_at" # never seen this one before either.... Your guess is as good as mine??
59
+
60
+ Usage
61
+ -----
58
62
 
59
63
  1. Log all actions in a controller
60
64
 
61
- WidgetsController < ApplicationController
62
- impressionist
63
- end
65
+ WidgetsController < ApplicationController
66
+ impressionist
67
+ end
64
68
 
65
69
  2. Specify actions you want logged in a controller
66
70
 
67
- WidgetsController < ApplicationController
68
- impressionist :actions=>[:show,:index]
69
- end
71
+ WidgetsController < ApplicationController
72
+ impressionist :actions=>[:show,:index]
73
+ end
70
74
 
71
75
  3. Make your models impressionable. This allows you to attach impressions to an AR model instance. Impressionist will automatically log the Model name (based on action_name) and the id (based on params[:id]), but in order to get the count of impressions (example: @widget.impression_count), you will need to make your model impressionalble
72
76
 
73
- class Widget < ActiveRecord::Base
74
- is_impressionable
75
- end
77
+ class Widget < ActiveRecord::Base
78
+ is_impressionable
79
+ end
76
80
 
77
81
  4. Log an impression per model instance in your controller. Note that it is not necessary to specify "impressionist" (usage #1) in the top of you controller if you are using this method. If you add "impressionist" to the top of your controller and also use this method in your action, it will result in 2 impressions being logged (but associated with one request_hash)
78
82
 
79
- def show
80
- @widget = Widget.find
81
- impressionist(@widget,message:"wtf is a widget?") #message is optional
82
- end
83
+ def show
84
+ @widget = Widget.find
85
+ impressionist(@widget,message:"wtf is a widget?") #message is optional
86
+ end
83
87
 
84
88
  5. Get unique impression count from a model. This groups impressions by request_hash, so if you logged multiple impressions per request, it will only count them one time. This unique impression count will not filter out unique users, only unique requests
85
- @widget.unique_impression_count
86
- @widget.unique_impression_count("2011-01-01","2011-01-02") # start date, end date
87
- @widget.unique_impression_count("2011-01-01") #specify start date only, end date = now
89
+ @widget.unique_impression_count
90
+ @widget.unique_impression_count("2011-01-01","2011-01-02") # start date, end date
91
+ @widget.unique_impression_count("2011-01-01") #specify start date only, end date = now
88
92
 
89
93
  6. Get the unique impression count from a model filtered by IP address. This in turn will give you impressions with unique request_hash, since rows with the same request_hash will have the same IP address.
90
- @widget.unique_impression_count_ip
91
- @widget.unique_impression_count_ip("2011-01-01","2011-01-02") # start date, end date
92
- @widget.unique_impression_count_ip("2011-01-01") #specify start date only, end date = now
94
+ @widget.unique_impression_count_ip
95
+ @widget.unique_impression_count_ip("2011-01-01","2011-01-02") # start date, end date
96
+ @widget.unique_impression_count_ip("2011-01-01") #specify start date only, end date = now
93
97
 
94
98
  7. Get the unique impression count from a model filtered by session hash. Same as #6 regarding request hash. This may be more desirable than filtering by IP address depending on your situation, since filtering by IP may ignore visitors that use the same IP. The downside to this filtering is that a user could clear session data in their browser and skew the results.
95
- @widget.unique_impression_count_session
96
- @widget.unique_impression_count_session("2011-01-01","2011-01-02") # start date, end date
97
- @widget.unique_impression_count_session("2011-01-01") #specify start date only, end date = now
99
+ @widget.unique_impression_count_session
100
+ @widget.unique_impression_count_session("2011-01-01","2011-01-02") # start date, end date
101
+ @widget.unique_impression_count_session("2011-01-01") #specify start date only, end date = now
98
102
 
99
103
  8. Get total impression count. This may return more than 1 impression per http request, depending on how you are logging impressions
100
- @widget.impression_count
101
- @widget.impression_count("2011-01-01","2011-01-02") # start date, end date
102
- @widget.impression_count("2011-01-01") #specify start date only, end date = now
104
+ @widget.impression_count
105
+ @widget.impression_count("2011-01-01","2011-01-02") # start date, end date
106
+ @widget.impression_count("2011-01-01") #specify start date only, end date = now
103
107
 
104
108
  Logging impressions for authenticated users happens automatically. If you have a current_user helper or use @current_user in your before_filter to set your authenticated user, current_user.id will be written to the user_id field in the impressions table.
105
109
 
106
110
 
107
- == Development Roadmap
111
+ Development Roadmap
112
+ -------------------
108
113
  * Automatic impression logging in views. For example, log initial view, and any partials called from initial view
109
114
  * Customizable black list for user-agents or IP addresses. Impressions will be ignored. Web admin as part of the Engine.
110
115
  * Reporting engine
111
116
  * AB testing integration
112
117
 
113
- == Contributing to impressionist
114
-
118
+ Contributing to impressionist
119
+ -----------------------------
115
120
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
116
121
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
117
122
  * Fork the project
@@ -120,8 +125,9 @@ Logging impressions for authenticated users happens automatically. If you have
120
125
  * Make sure to add rpsec tests for it. Patches or features without tests will be ignored. Also, try to write better tests than I do ;-)
121
126
  * If adding engine controller or view functionality, use HAML and Inherited Resources.
122
127
  * All testing is done inside a small Rails app (test_app). You will find specs within this app.
123
- == Copyright
124
128
 
129
+ Copyright
130
+ ---------
125
131
  Copyright (c) 2011 cowboycoded. See LICENSE.txt for
126
132
  further details.
127
133
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -5,22 +5,22 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{impressionist}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["cowboycoded"]
12
- s.date = %q{2011-03-06}
12
+ s.date = %q{2011-03-21}
13
13
  s.description = %q{Log impressions from controller actions or from a model}
14
14
  s.email = %q{john.mcaliley@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  "CHANGELOG.rdoc",
21
21
  "Gemfile",
22
22
  "LICENSE.txt",
23
- "README.rdoc",
23
+ "README.md",
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "app/controllers/impressionist_controller.rb",
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
35
35
  "lib/impressionist/bots.rb",
36
36
  "lib/impressionist/engine.rb",
37
37
  "lib/impressionist/railties/tasks.rake",
38
+ "logo.png",
38
39
  "upgrade_migrations/version_0_3_0.rb"
39
40
  ]
40
41
  s.homepage = %q{http://github.com/cowboycoded/impressionist}
data/logo.png ADDED
Binary file
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 1
9
- version: 0.3.1
8
+ - 2
9
+ version: 0.3.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - cowboycoded
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-06 00:00:00 -05:00
17
+ date: 2011-03-21 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -266,12 +266,12 @@ extensions: []
266
266
 
267
267
  extra_rdoc_files:
268
268
  - LICENSE.txt
269
- - README.rdoc
269
+ - README.md
270
270
  files:
271
271
  - CHANGELOG.rdoc
272
272
  - Gemfile
273
273
  - LICENSE.txt
274
- - README.rdoc
274
+ - README.md
275
275
  - Rakefile
276
276
  - VERSION
277
277
  - app/controllers/impressionist_controller.rb
@@ -286,6 +286,7 @@ files:
286
286
  - lib/impressionist/bots.rb
287
287
  - lib/impressionist/engine.rb
288
288
  - lib/impressionist/railties/tasks.rake
289
+ - logo.png
289
290
  - upgrade_migrations/version_0_3_0.rb
290
291
  has_rdoc: true
291
292
  homepage: http://github.com/cowboycoded/impressionist
@@ -301,7 +302,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
301
302
  requirements:
302
303
  - - ">="
303
304
  - !ruby/object:Gem::Version
304
- hash: 2559717242736027668
305
+ hash: 916626274296505275
305
306
  segments:
306
307
  - 0
307
308
  version: "0"