ahoy_matey 1.5.5 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +184 -34
  3. data/CONTRIBUTING.md +42 -0
  4. data/LICENSE.txt +1 -1
  5. data/README.md +464 -407
  6. data/app/controllers/ahoy/base_controller.rb +23 -15
  7. data/app/controllers/ahoy/events_controller.rb +8 -2
  8. data/app/controllers/ahoy/visits_controller.rb +8 -1
  9. data/app/jobs/ahoy/geocode_job.rb +11 -0
  10. data/app/jobs/ahoy/geocode_v2_job.rb +31 -0
  11. data/config/routes.rb +1 -1
  12. data/lib/ahoy/base_store.rb +101 -0
  13. data/lib/ahoy/controller.rb +23 -16
  14. data/lib/ahoy/database_store.rb +94 -0
  15. data/lib/ahoy/engine.rb +14 -7
  16. data/lib/ahoy/helper.rb +40 -0
  17. data/lib/ahoy/model.rb +5 -27
  18. data/lib/ahoy/query_methods.rb +88 -0
  19. data/lib/ahoy/tracker.rb +105 -51
  20. data/lib/ahoy/utils.rb +7 -0
  21. data/lib/ahoy/version.rb +1 -1
  22. data/lib/ahoy/visit_properties.rb +99 -37
  23. data/lib/ahoy.rb +83 -93
  24. data/lib/ahoy_matey.rb +1 -1
  25. data/lib/generators/ahoy/activerecord_generator.rb +67 -0
  26. data/lib/generators/ahoy/base_generator.rb +13 -0
  27. data/lib/generators/ahoy/install_generator.rb +44 -0
  28. data/lib/generators/ahoy/mongoid_generator.rb +16 -0
  29. data/lib/generators/ahoy/templates/active_record_event_model.rb.tt +10 -0
  30. data/lib/generators/ahoy/templates/active_record_migration.rb.tt +62 -0
  31. data/lib/generators/ahoy/templates/active_record_visit_model.rb.tt +6 -0
  32. data/lib/generators/ahoy/templates/base_store_initializer.rb.tt +25 -0
  33. data/lib/generators/ahoy/templates/database_store_initializer.rb.tt +10 -0
  34. data/lib/generators/ahoy/{stores/templates/mongoid_event_model.rb → templates/mongoid_event_model.rb.tt} +4 -2
  35. data/lib/generators/ahoy/{stores/templates/mongoid_visit_model.rb → templates/mongoid_visit_model.rb.tt} +15 -9
  36. data/vendor/assets/javascripts/ahoy.js +271 -133
  37. metadata +37 -273
  38. data/.gitignore +0 -17
  39. data/Gemfile +0 -6
  40. data/Rakefile +0 -8
  41. data/ahoy_matey.gemspec +0 -38
  42. data/lib/ahoy/deckhands/location_deckhand.rb +0 -49
  43. data/lib/ahoy/deckhands/request_deckhand.rb +0 -52
  44. data/lib/ahoy/deckhands/technology_deckhand.rb +0 -47
  45. data/lib/ahoy/deckhands/traffic_source_deckhand.rb +0 -22
  46. data/lib/ahoy/deckhands/utm_parameter_deckhand.rb +0 -23
  47. data/lib/ahoy/geocode_job.rb +0 -13
  48. data/lib/ahoy/logger_silencer.rb +0 -75
  49. data/lib/ahoy/properties.rb +0 -58
  50. data/lib/ahoy/stores/active_record_store.rb +0 -61
  51. data/lib/ahoy/stores/active_record_token_store.rb +0 -114
  52. data/lib/ahoy/stores/base_store.rb +0 -88
  53. data/lib/ahoy/stores/bunny_store.rb +0 -33
  54. data/lib/ahoy/stores/fluentd_store.rb +0 -17
  55. data/lib/ahoy/stores/kafka_store.rb +0 -40
  56. data/lib/ahoy/stores/kinesis_firehose_store.rb +0 -42
  57. data/lib/ahoy/stores/log_store.rb +0 -53
  58. data/lib/ahoy/stores/mongoid_store.rb +0 -63
  59. data/lib/ahoy/stores/nats_store.rb +0 -34
  60. data/lib/ahoy/stores/nsq_store.rb +0 -36
  61. data/lib/ahoy/subscribers/active_record.rb +0 -19
  62. data/lib/ahoy/throttle.rb +0 -17
  63. data/lib/generators/ahoy/stores/active_record_events_generator.rb +0 -53
  64. data/lib/generators/ahoy/stores/active_record_generator.rb +0 -16
  65. data/lib/generators/ahoy/stores/active_record_visits_generator.rb +0 -43
  66. data/lib/generators/ahoy/stores/bunny_generator.rb +0 -15
  67. data/lib/generators/ahoy/stores/custom_generator.rb +0 -15
  68. data/lib/generators/ahoy/stores/fluentd_generator.rb +0 -15
  69. data/lib/generators/ahoy/stores/kafka_generator.rb +0 -15
  70. data/lib/generators/ahoy/stores/kinesis_firehose_generator.rb +0 -15
  71. data/lib/generators/ahoy/stores/log_generator.rb +0 -15
  72. data/lib/generators/ahoy/stores/mongoid_events_generator.rb +0 -19
  73. data/lib/generators/ahoy/stores/mongoid_generator.rb +0 -14
  74. data/lib/generators/ahoy/stores/mongoid_visits_generator.rb +0 -27
  75. data/lib/generators/ahoy/stores/nats_generator.rb +0 -15
  76. data/lib/generators/ahoy/stores/nsq_generator.rb +0 -15
  77. data/lib/generators/ahoy/stores/templates/active_record_event_model.rb +0 -12
  78. data/lib/generators/ahoy/stores/templates/active_record_events_migration.rb +0 -19
  79. data/lib/generators/ahoy/stores/templates/active_record_initializer.rb +0 -3
  80. data/lib/generators/ahoy/stores/templates/active_record_visit_model.rb +0 -4
  81. data/lib/generators/ahoy/stores/templates/active_record_visits_migration.rb +0 -57
  82. data/lib/generators/ahoy/stores/templates/bunny_initializer.rb +0 -9
  83. data/lib/generators/ahoy/stores/templates/custom_initializer.rb +0 -10
  84. data/lib/generators/ahoy/stores/templates/fluentd_initializer.rb +0 -3
  85. data/lib/generators/ahoy/stores/templates/kafka_initializer.rb +0 -9
  86. data/lib/generators/ahoy/stores/templates/kinesis_firehose_initializer.rb +0 -17
  87. data/lib/generators/ahoy/stores/templates/log_initializer.rb +0 -3
  88. data/lib/generators/ahoy/stores/templates/mongoid_initializer.rb +0 -3
  89. data/lib/generators/ahoy/stores/templates/nats_initializer.rb +0 -9
  90. data/lib/generators/ahoy/stores/templates/nsq_initializer.rb +0 -9
  91. data/test/properties/mysql_json_test.rb +0 -18
  92. data/test/properties/mysql_text_test.rb +0 -19
  93. data/test/properties/postgresql_hstore_test.rb +0 -18
  94. data/test/properties/postgresql_json_test.rb +0 -18
  95. data/test/properties/postgresql_jsonb_test.rb +0 -18
  96. data/test/properties/postgresql_text_test.rb +0 -19
  97. data/test/test_helper.rb +0 -99
  98. data/test/visit_properties_test.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fb739af8b0e101e97b738d5839b438da101fc41f
4
- data.tar.gz: 5c202d2758f9fe5b33a6aa142e8a2c7520ff1f92
2
+ SHA256:
3
+ metadata.gz: fc5fc1f8ed102bd4a3fa7e78a5404c7d40b698d59cbbc644c5322e2bcb1b2e52
4
+ data.tar.gz: 7100ab100ed3a6ae66a4c4aa6b14c3c2e817c273ab677b7befbc6350fec5cff8
5
5
  SHA512:
6
- metadata.gz: 7d65012b0f13dc8c79bc0efed4ef4c0f5618fa5356eab36881cd44ebcf74029b9ab8820a6b160cf4d4713e8a910bb17e6f57391e0add52804855dd8963c7a58c
7
- data.tar.gz: a16fb236d50969a9a3ba95ca28f2f1f6e4ffa4c6715eedb854bec2cb7f57257a4812d4b46c94ae0fdfd44146b9e60f336faf3944976e3d0dbf221ade9c6d3088
6
+ metadata.gz: a41dd47317ab2932e0ddcc9231f3cca78887cdf2cf98ca3506cb0ccd8f1f70ed050dafe8e17e764224fe29018ba5cb35afab5068059338f63e832298d98547cd
7
+ data.tar.gz: f170800b1f7490aec5be31dab5e59f5824ab0a261ceb4fac9b5a1ad31fd8525c7f424c3f2080c8e75f9564763a69c9c6a56a854c848d1453cc3299b5f5c822f0
data/CHANGELOG.md CHANGED
@@ -1,46 +1,196 @@
1
- ## 1.5.5
1
+ ## 4.2.1 (2023-02-23)
2
+
3
+ - Updated Ahoy.js to 0.4.2
4
+
5
+ ## 4.2.0 (2023-02-07)
6
+
7
+ - Added primary key type to generated migration
8
+ - Updated Ahoy.js to 0.4.1
9
+
10
+ ## 4.1.0 (2022-06-12)
11
+
12
+ - Ensure `exclude_method` is only called once per request
13
+ - Fixed error with Mongoid when `Mongoid.raise_not_found_error` is `true`
14
+ - Fixed association for Mongoid
15
+
16
+ ## 4.0.3 (2022-01-15)
17
+
18
+ - Support for `importmap-rails` is no longer experimental
19
+ - Fixed asset precompilation error with `importmap-rails`
20
+
21
+ ## 4.0.2 (2021-11-06)
22
+
23
+ - Added experimental support for `importmap-rails`
24
+
25
+ ## 4.0.1 (2021-08-18)
26
+
27
+ - Added support for `where_event`, `where_props`, and `where_group` for SQLite
28
+ - Fixed results with `where_event` for MySQL, MariaDB, and Postgres `hstore`
29
+ - Fixed results with `where_props` and `where_group` when used with other scopes for MySQL, MariaDB, and Postgres `hstore`
30
+
31
+ ## 4.0.0 (2021-08-14)
32
+
33
+ - Disabled geocoding by default (this was already the case for new installations with 3.2.0+)
34
+ - Made the `geocoder` gem an optional dependency
35
+ - Updated Ahoy.js to 0.4.0
36
+ - Updated API to return 400 status code when missing required parameters
37
+ - Dropped support for Ruby < 2.6 and Rails < 5.2
38
+
39
+ ## 3.3.0 (2021-08-13)
40
+
41
+ - Added `country_code` to geocoding
42
+ - Updated Ahoy.js to 0.3.9
43
+ - Fixed install generator for MariaDB
44
+
45
+ ## 3.2.0 (2021-03-01)
46
+
47
+ - Disabled geocoding by default for new installations
48
+ - Fixed deprecation warning with Active Record 6.1
49
+
50
+ ## 3.1.0 (2020-12-04)
51
+
52
+ - Added `instance` method
53
+ - Added `request` argument to `user_method`
54
+ - Updated Ahoy.js to 0.3.8
55
+ - Removed `exclude_method` call when geocoding
56
+
57
+ ## 3.0.5 (2020-09-09)
58
+
59
+ - Added `group_prop` method
60
+ - Use `datetime` type in migration
61
+
62
+ ## 3.0.4 (2020-06-07)
63
+
64
+ - Updated Ahoy.js to 0.3.6
65
+
66
+ ## 3.0.3 (2020-04-17)
67
+
68
+ - Updated Ahoy.js to 0.3.5
69
+
70
+ ## 3.0.2 (2020-04-03)
71
+
72
+ - Added `cookie_options`
73
+
74
+ ## 3.0.1 (2019-09-21)
75
+
76
+ - Made `Ahoy::Tracker` work outside of requests
77
+ - Fixed storage of `false` values with customized store
78
+ - Fixed error with `user_method` and `Rails::InfoController`
79
+ - Gracefully handle `ActionDispatch::RemoteIp::IpSpoofAttackError`
80
+
81
+ ## 3.0.0 (2019-05-29)
82
+
83
+ - Made Device Detector the default user agent parser
84
+ - Made v2 the default bot detection version
85
+ - Removed a large number of dependencies
86
+ - Removed search keyword detection (most search engines today prevent this)
87
+ - Removed support for Rails < 5
88
+
89
+ ## 2.2.1 (2019-05-26)
90
+
91
+ - Updated Ahoy.js to 0.3.4
92
+ - Fixed v2 bot detection
93
+ - Added latitude and longitude to installation
94
+
95
+ ## 2.2.0 (2019-01-04)
96
+
97
+ - Added `amp_event` helper
98
+ - Improved bot detection for Device Detector
99
+
100
+ ## 2.1.0 (2018-05-18)
101
+
102
+ - Added option for IP masking
103
+ - Added option to use anonymity sets instead of cookies
104
+ - Added `user_agent_parser` option
105
+ - Fixed `visitable` for Rails 4.2
106
+ - Removed `search_keyword` from new installs
107
+
108
+ ## 2.0.2 (2018-03-14)
109
+
110
+ - Fixed error on duplicate records
111
+ - Fixed message when visit not found for geocoding
112
+ - Better compatibility with GeoLite2
113
+ - Better browser compatibility for Ahoy.js
114
+
115
+ ## 2.0.1 (2018-02-26)
116
+
117
+ - Added `Ahoy.server_side_visits = :when_needed` to automatically create visits server-side when needed for events and `visitable`
118
+ - Better handling of visit duration and expiration in JavaScript
119
+
120
+ ## 2.0.0 (2018-02-25)
121
+
122
+ - Removed dependency on jQuery
123
+ - Use `navigator.sendBeacon` by default in supported browsers
124
+ - Added `geocode` event
125
+ - Added `where_event` method for querying events
126
+ - Added support for `visitable` and `where_props` to Mongoid
127
+ - Added `preserve_callbacks` option
128
+ - Use `json` for MySQL by default
129
+ - Fixed log silencing
130
+
131
+ Breaking changes
132
+
133
+ - Simpler interface for data stores
134
+ - Renamed `track_visits_immediately` to `server_side_visits` and enabled by default
135
+ - Renamed `mount` option to `api` and disabled by default
136
+ - Enabled `protect_from_forgery` by default
137
+ - Removed deprecated options
138
+ - Removed throttling
139
+ - Removed most built-in stores
140
+ - Removed support for Rails < 4.2
141
+
142
+ ## 1.6.1 (2018-02-02)
143
+
144
+ - Added `gin` index on properties for events
145
+ - Fixed `visitable` options when name not provided
146
+
147
+ ## 1.6.0 (2017-05-01)
148
+
149
+ - Added support for Rails 5.1
150
+
151
+ ## 1.5.5 (2017-03-23)
2
152
 
3
153
  - Added support for Rails API
4
154
  - Added NATS and NSQ stores
5
155
 
6
- ## 1.5.4
156
+ ## 1.5.4 (2017-01-22)
7
157
 
8
158
  - Fixed issue with duplicate events
9
159
  - Added support for PostGIS for `where_properties`
10
160
 
11
- ## 1.5.3
161
+ ## 1.5.3 (2016-10-31)
12
162
 
13
163
  - Fixed error with Rails 5 and Mongoid 6
14
164
  - Fixed regression with server not generating visit and visitor tokens
15
165
  - Accept UTM parameters as request parameters (for native apps)
16
166
 
17
- ## 1.5.2
167
+ ## 1.5.2 (2016-08-26)
18
168
 
19
169
  - Better support for Rails 5
20
170
 
21
- ## 1.5.1
171
+ ## 1.5.1 (2016-08-19)
22
172
 
23
173
  - Restored throttling after removing side effects
24
174
 
25
- ## 1.5.0
175
+ ## 1.5.0 (2016-08-19)
26
176
 
27
177
  - Removed throttling due to unintended side effects with its implementation
28
178
  - Ensure basic token requirements
29
179
  - Fixed visit recreation on cookie expiration
30
180
  - Fixed issue where `/ahoy/visits` is called indefinitely when `Ahoy.cookie_domain = :all`
31
181
 
32
- ## 1.4.2
182
+ ## 1.4.2 (2016-06-21)
33
183
 
34
184
  - Fixed issues with `where_properties`
35
185
 
36
- ## 1.4.1
186
+ ## 1.4.1 (2016-06-20)
37
187
 
38
188
  - Added `where_properties` method
39
189
  - Added Kafka store
40
190
  - Added `mount` option
41
191
  - Use less intrusive version of `safely`
42
192
 
43
- ## 1.4.0
193
+ ## 1.4.0 (2016-03-23)
44
194
 
45
195
  - Use `ActiveRecordTokenStore` by default (integer instead of uuid for id)
46
196
  - Detect database for `rails g ahoy:stores:active_record` for easier installation
@@ -48,55 +198,55 @@
48
198
  - Fixed issue with log silencer
49
199
  - Use multi-column indexes on `ahoy_events` table creation
50
200
 
51
- ## 1.3.1
201
+ ## 1.3.1 (2016-03-22)
52
202
 
53
203
  - Raise errors in test environment
54
204
 
55
- ## 1.3.0
205
+ ## 1.3.0 (2016-03-06)
56
206
 
57
207
  - Added throttling
58
208
  - Added `max_content_length` and `max_events_per_request`
59
209
 
60
- ## 1.2.2
210
+ ## 1.2.2 (2016-03-05)
61
211
 
62
212
  - Fixed issue with latest version of `browser` gem
63
213
  - Added support for RabbitMQ
64
214
  - Added support for Amazon Kinesis Firehose
65
215
  - Fixed deprecation warnings in Rails 5
66
216
 
67
- ## 1.2.1
217
+ ## 1.2.1 (2015-08-14)
68
218
 
69
219
  - Fixed `SystemStackError: stack level too deep` when used with `activerecord-session_store`
70
220
 
71
- ## 1.2.0
221
+ ## 1.2.0 (2015-06-07)
72
222
 
73
223
  - Added support for PostgreSQL `jsonb` column type
74
224
  - Added Fluentd store
75
225
  - Added latitude, longitude, and postal_code to visits
76
226
  - Log exclusions
77
227
 
78
- ## 1.1.1
228
+ ## 1.1.1 (2015-01-05)
79
229
 
80
230
  - Better support for Authlogic
81
231
  - Added `screen_height` and `screen_width`
82
232
 
83
- ## 1.1.0
233
+ ## 1.1.0 (2014-11-02)
84
234
 
85
235
  - Added `geocode` option
86
236
  - Report errors to service by default
87
237
  - Fixed association mismatch
88
238
 
89
- ## 1.0.2
239
+ ## 1.0.2 (2014-07-10)
90
240
 
91
241
  - Fixed BSON for Mongoid 3
92
242
  - Fixed Doorkeeper integration
93
243
  - Fixed user tracking in overridden authenticate method
94
244
 
95
- ## 1.0.1
245
+ ## 1.0.1 (2014-06-27)
96
246
 
97
247
  - Fixed `visitable` outside of requests
98
248
 
99
- ## 1.0.0
249
+ ## 1.0.0 (2014-06-18)
100
250
 
101
251
  - Added support for any data store, and Mongoid out of the box
102
252
  - Added `track_visits_immediately` option
@@ -104,17 +254,17 @@
104
254
  - Visits expire after inactivity, not fixed interval
105
255
  - Added `visit_duration` and `visitor_duration` options
106
256
 
107
- ## 0.3.2
257
+ ## 0.3.2 (2014-06-15)
108
258
 
109
259
  - Fixed bot exclusion for visits
110
260
  - Fixed user method
111
261
 
112
- ## 0.3.1
262
+ ## 0.3.1 (2014-06-12)
113
263
 
114
264
  - Fixed visitor cookies when set on server
115
265
  - Added `domain` option for server cookies
116
266
 
117
- ## 0.3.0
267
+ ## 0.3.0 (2014-06-11)
118
268
 
119
269
  - Added `current_visit_token` and `current_visitor_token` method
120
270
  - Switched to UUIDs
@@ -122,47 +272,47 @@
122
272
  - Skip server-side bot events
123
273
  - Added `request` argument to `exclude_method`
124
274
 
125
- ## 0.2.2
275
+ ## 0.2.2 (2014-05-26)
126
276
 
127
277
  - Added `exclude_method` option
128
278
  - Added support for batch events
129
279
  - Fixed cookie encoding
130
280
  - Fixed `options` variable from being modified
131
281
 
132
- ## 0.2.1
282
+ ## 0.2.1 (2014-05-16)
133
283
 
134
284
  - Fixed IE 8 error
135
285
  - Added `track_bots` option
136
286
  - Added `$authenticate` event
137
287
 
138
- ## 0.2.0
288
+ ## 0.2.0 (2014-05-13)
139
289
 
140
290
  - Added event tracking (merged ahoy_events)
141
291
  - Added ahoy.js
142
292
 
143
- ## 0.1.8
293
+ ## 0.1.8 (2014-05-11)
144
294
 
145
295
  - Fixed bug with `user_type` set to `false` instead of `nil`
146
296
 
147
- ## 0.1.7
297
+ ## 0.1.7 (2014-05-11)
148
298
 
149
299
  - Made cookie functions public for ahoy_events
150
300
 
151
- ## 0.1.6
301
+ ## 0.1.6 (2014-05-07)
152
302
 
153
303
  - Better user agent parser
154
304
 
155
- ## 0.1.5
305
+ ## 0.1.5 (2014-05-01)
156
306
 
157
307
  - Added support for Doorkeeper
158
308
  - Added options to `visitable`
159
309
  - Added `landing_params` method
160
310
 
161
- ## 0.1.4
311
+ ## 0.1.4 (2014-04-27)
162
312
 
163
313
  - Added `ahoy.ready()` and `ahoy.log()` for events
164
314
 
165
- ## 0.1.3
315
+ ## 0.1.3 (2014-04-24)
166
316
 
167
317
  - Supports `current_user` from `ApplicationController`
168
318
  - Added `ahoy.reset()`
@@ -170,16 +320,16 @@
170
320
  - Added experimental support for native apps
171
321
  - Prefer `ahoy` over `Ahoy`
172
322
 
173
- ## 0.1.2
323
+ ## 0.1.2 (2014-04-15)
174
324
 
175
325
  - Attach user on Devise sign up
176
326
  - Ability to specify visit model
177
327
 
178
- ## 0.1.1
328
+ ## 0.1.1 (2014-03-20)
179
329
 
180
330
  - Made most database columns optional
181
331
  - Performance hack for referer-parser
182
332
 
183
- ## 0.1.0
333
+ ## 0.1.0 (2014-03-19)
184
334
 
185
335
  - First major release
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,42 @@
1
+ # Contributing
2
+
3
+ First, thanks for wanting to contribute. You’re awesome! :heart:
4
+
5
+ ## Help
6
+
7
+ We’re not able to provide support through GitHub Issues. If you’re looking for help with your code, try posting on [Stack Overflow](https://stackoverflow.com/).
8
+
9
+ All features should be documented. If you don’t see a feature in the docs, assume it doesn’t exist.
10
+
11
+ ## Bugs
12
+
13
+ Think you’ve discovered a bug?
14
+
15
+ 1. Search existing issues to see if it’s been reported.
16
+ 2. Try the `master` branch to make sure it hasn’t been fixed.
17
+
18
+ ```rb
19
+ gem "ahoy_matey", github: "ankane/ahoy"
20
+ ```
21
+
22
+ If the above steps don’t help, create an issue. Include:
23
+
24
+ - Detailed steps to reproduce
25
+ - Complete backtraces for exceptions
26
+
27
+ ## New Features
28
+
29
+ If you’d like to discuss a new feature, create an issue and start the title with `[Idea]`.
30
+
31
+ ## Pull Requests
32
+
33
+ Fork the project and create a pull request. A few tips:
34
+
35
+ - Keep changes to a minimum. If you have multiple features or fixes, submit multiple pull requests.
36
+ - Follow the existing style. The code should read like it’s written by a single person.
37
+
38
+ Feel free to open an issue to get feedback on your idea before spending too much time on it.
39
+
40
+ ---
41
+
42
+ This contributing guide is released under [CCO](https://creativecommons.org/publicdomain/zero/1.0/) (public domain). Use it for your own project without attribution.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Andrew Kane
1
+ Copyright (c) 2014-2023 Andrew Kane
2
2
 
3
3
  MIT License
4
4