ahoy_matey 2.2.1 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7b0851dfc7538c6768d6f694d7e8356f0aef3e3ff66ba361447e000a2db5bac
4
- data.tar.gz: c28eb30ab780037d83550d359a36d6790e3a16f60b314b5d0be170d11b3c427b
3
+ metadata.gz: 141aeb0d7f78023ecefb04f274637e06c68d6d8af9ece0ac583d8cff701b59f9
4
+ data.tar.gz: f44945bbdad4be224a57b4e915175ef983c4c24ed28eca4accc8e5fcce171105
5
5
  SHA512:
6
- metadata.gz: 85fb407054564104efc83ae3d425c6253db7495d6f6d4156c741156f64fcd7fe048035f78e4563bf9ec92c69c7e6dfef41e29f7d1031174705b17c595ef96572
7
- data.tar.gz: ff03757afbb0deca1a11dc4ece02310bbd8a03f644f675c2eee32c1bf7711013f0cd38eb0fd009541b97b3a5b914a756279e88dbe0cbc8a8bd14ed064d648089
6
+ metadata.gz: ee9f88551691cc6be92b5adf9bfd0495065e43510679a61377bc12082c44ac7b0cff544ca88b3157ec92d05432ff58e654b491c7e256eb2c6032b5517573e6e3
7
+ data.tar.gz: 45565919c04c0f7c05cf87d0ef0f35fedd867cbd7569ee72a613770efab6a0c7dac1d884d6d0830c4f28efcf475ece191e7d44cb3712b18454c30b0de1658a4d
@@ -1,15 +1,42 @@
1
- ## 2.2.1
1
+ ## 3.0.4 (2020-06-07)
2
+
3
+ - Updated Ahoy.js to 0.3.6
4
+
5
+ ## 3.0.3 (2020-04-17)
6
+
7
+ - Updated Ahoy.js to 0.3.5
8
+
9
+ ## 3.0.2 (2020-04-03)
10
+
11
+ - Added `cookie_options`
12
+
13
+ ## 3.0.1 (2019-09-21)
14
+
15
+ - Made `Ahoy::Tracker` work outside of requests
16
+ - Fixed storage of `false` values with customized store
17
+ - Fixed error with `user_method` and `Rails::InfoController`
18
+ - Gracefully handle `ActionDispatch::RemoteIp::IpSpoofAttackError`
19
+
20
+ ## 3.0.0 (2019-05-29)
21
+
22
+ - Made Device Detector the default user agent parser
23
+ - Made v2 the default bot detection version
24
+ - Removed a large number of dependencies
25
+ - Removed search keyword detection (most search engines today prevent this)
26
+ - Removed support for Rails < 5
27
+
28
+ ## 2.2.1 (2019-05-26)
2
29
 
3
30
  - Updated Ahoy.js to 0.3.4
4
31
  - Fixed v2 bot detection
5
32
  - Added latitude and longitude to installation
6
33
 
7
- ## 2.2.0
34
+ ## 2.2.0 (2019-01-04)
8
35
 
9
36
  - Added `amp_event` helper
10
37
  - Improved bot detection for Device Detector
11
38
 
12
- ## 2.1.0
39
+ ## 2.1.0 (2018-05-18)
13
40
 
14
41
  - Added option for IP masking
15
42
  - Added option to use anonymity sets instead of cookies
@@ -17,19 +44,19 @@
17
44
  - Fixed `visitable` for Rails 4.2
18
45
  - Removed `search_keyword` from new installs
19
46
 
20
- ## 2.0.2
47
+ ## 2.0.2 (2018-03-14)
21
48
 
22
49
  - Fixed error on duplicate records
23
50
  - Fixed message when visit not found for geocoding
24
51
  - Better compatibility with GeoLite2
25
52
  - Better browser compatibility for Ahoy.js
26
53
 
27
- ## 2.0.1
54
+ ## 2.0.1 (2018-02-26)
28
55
 
29
56
  - Added `Ahoy.server_side_visits = :when_needed` to automatically create visits server-side when needed for events and `visitable`
30
57
  - Better handling of visit duration and expiration in JavaScript
31
58
 
32
- ## 2.0.0
59
+ ## 2.0.0 (2018-02-25)
33
60
 
34
61
  - Removed dependency on jQuery
35
62
  - Use `navigator.sendBeacon` by default in supported browsers
@@ -51,58 +78,58 @@ Breaking changes
51
78
  - Removed most built-in stores
52
79
  - Removed support for Rails < 4.2
53
80
 
54
- ## 1.6.1
81
+ ## 1.6.1 (2018-02-02)
55
82
 
56
83
  - Added `gin` index on properties for events
57
84
  - Fixed `visitable` options when name not provided
58
85
 
59
- ## 1.6.0
86
+ ## 1.6.0 (2017-05-01)
60
87
 
61
88
  - Added support for Rails 5.1
62
89
 
63
- ## 1.5.5
90
+ ## 1.5.5 (2017-03-23)
64
91
 
65
92
  - Added support for Rails API
66
93
  - Added NATS and NSQ stores
67
94
 
68
- ## 1.5.4
95
+ ## 1.5.4 (2017-01-22)
69
96
 
70
97
  - Fixed issue with duplicate events
71
98
  - Added support for PostGIS for `where_properties`
72
99
 
73
- ## 1.5.3
100
+ ## 1.5.3 (2016-10-31)
74
101
 
75
102
  - Fixed error with Rails 5 and Mongoid 6
76
103
  - Fixed regression with server not generating visit and visitor tokens
77
104
  - Accept UTM parameters as request parameters (for native apps)
78
105
 
79
- ## 1.5.2
106
+ ## 1.5.2 (2016-08-26)
80
107
 
81
108
  - Better support for Rails 5
82
109
 
83
- ## 1.5.1
110
+ ## 1.5.1 (2016-08-19)
84
111
 
85
112
  - Restored throttling after removing side effects
86
113
 
87
- ## 1.5.0
114
+ ## 1.5.0 (2016-08-19)
88
115
 
89
116
  - Removed throttling due to unintended side effects with its implementation
90
117
  - Ensure basic token requirements
91
118
  - Fixed visit recreation on cookie expiration
92
119
  - Fixed issue where `/ahoy/visits` is called indefinitely when `Ahoy.cookie_domain = :all`
93
120
 
94
- ## 1.4.2
121
+ ## 1.4.2 (2016-06-21)
95
122
 
96
123
  - Fixed issues with `where_properties`
97
124
 
98
- ## 1.4.1
125
+ ## 1.4.1 (2016-06-20)
99
126
 
100
127
  - Added `where_properties` method
101
128
  - Added Kafka store
102
129
  - Added `mount` option
103
130
  - Use less intrusive version of `safely`
104
131
 
105
- ## 1.4.0
132
+ ## 1.4.0 (2016-03-23)
106
133
 
107
134
  - Use `ActiveRecordTokenStore` by default (integer instead of uuid for id)
108
135
  - Detect database for `rails g ahoy:stores:active_record` for easier installation
@@ -110,55 +137,55 @@ Breaking changes
110
137
  - Fixed issue with log silencer
111
138
  - Use multi-column indexes on `ahoy_events` table creation
112
139
 
113
- ## 1.3.1
140
+ ## 1.3.1 (2016-03-22)
114
141
 
115
142
  - Raise errors in test environment
116
143
 
117
- ## 1.3.0
144
+ ## 1.3.0 (2016-03-06)
118
145
 
119
146
  - Added throttling
120
147
  - Added `max_content_length` and `max_events_per_request`
121
148
 
122
- ## 1.2.2
149
+ ## 1.2.2 (2016-03-05)
123
150
 
124
151
  - Fixed issue with latest version of `browser` gem
125
152
  - Added support for RabbitMQ
126
153
  - Added support for Amazon Kinesis Firehose
127
154
  - Fixed deprecation warnings in Rails 5
128
155
 
129
- ## 1.2.1
156
+ ## 1.2.1 (2015-08-14)
130
157
 
131
158
  - Fixed `SystemStackError: stack level too deep` when used with `activerecord-session_store`
132
159
 
133
- ## 1.2.0
160
+ ## 1.2.0 (2015-06-07)
134
161
 
135
162
  - Added support for PostgreSQL `jsonb` column type
136
163
  - Added Fluentd store
137
164
  - Added latitude, longitude, and postal_code to visits
138
165
  - Log exclusions
139
166
 
140
- ## 1.1.1
167
+ ## 1.1.1 (2015-01-05)
141
168
 
142
169
  - Better support for Authlogic
143
170
  - Added `screen_height` and `screen_width`
144
171
 
145
- ## 1.1.0
172
+ ## 1.1.0 (2014-11-02)
146
173
 
147
174
  - Added `geocode` option
148
175
  - Report errors to service by default
149
176
  - Fixed association mismatch
150
177
 
151
- ## 1.0.2
178
+ ## 1.0.2 (2014-07-10)
152
179
 
153
180
  - Fixed BSON for Mongoid 3
154
181
  - Fixed Doorkeeper integration
155
182
  - Fixed user tracking in overridden authenticate method
156
183
 
157
- ## 1.0.1
184
+ ## 1.0.1 (2014-06-27)
158
185
 
159
186
  - Fixed `visitable` outside of requests
160
187
 
161
- ## 1.0.0
188
+ ## 1.0.0 (2014-06-18)
162
189
 
163
190
  - Added support for any data store, and Mongoid out of the box
164
191
  - Added `track_visits_immediately` option
@@ -166,17 +193,17 @@ Breaking changes
166
193
  - Visits expire after inactivity, not fixed interval
167
194
  - Added `visit_duration` and `visitor_duration` options
168
195
 
169
- ## 0.3.2
196
+ ## 0.3.2 (2014-06-15)
170
197
 
171
198
  - Fixed bot exclusion for visits
172
199
  - Fixed user method
173
200
 
174
- ## 0.3.1
201
+ ## 0.3.1 (2014-06-12)
175
202
 
176
203
  - Fixed visitor cookies when set on server
177
204
  - Added `domain` option for server cookies
178
205
 
179
- ## 0.3.0
206
+ ## 0.3.0 (2014-06-11)
180
207
 
181
208
  - Added `current_visit_token` and `current_visitor_token` method
182
209
  - Switched to UUIDs
@@ -184,47 +211,47 @@ Breaking changes
184
211
  - Skip server-side bot events
185
212
  - Added `request` argument to `exclude_method`
186
213
 
187
- ## 0.2.2
214
+ ## 0.2.2 (2014-05-26)
188
215
 
189
216
  - Added `exclude_method` option
190
217
  - Added support for batch events
191
218
  - Fixed cookie encoding
192
219
  - Fixed `options` variable from being modified
193
220
 
194
- ## 0.2.1
221
+ ## 0.2.1 (2014-05-16)
195
222
 
196
223
  - Fixed IE 8 error
197
224
  - Added `track_bots` option
198
225
  - Added `$authenticate` event
199
226
 
200
- ## 0.2.0
227
+ ## 0.2.0 (2014-05-13)
201
228
 
202
229
  - Added event tracking (merged ahoy_events)
203
230
  - Added ahoy.js
204
231
 
205
- ## 0.1.8
232
+ ## 0.1.8 (2014-05-11)
206
233
 
207
234
  - Fixed bug with `user_type` set to `false` instead of `nil`
208
235
 
209
- ## 0.1.7
236
+ ## 0.1.7 (2014-05-11)
210
237
 
211
238
  - Made cookie functions public for ahoy_events
212
239
 
213
- ## 0.1.6
240
+ ## 0.1.6 (2014-05-07)
214
241
 
215
242
  - Better user agent parser
216
243
 
217
- ## 0.1.5
244
+ ## 0.1.5 (2014-05-01)
218
245
 
219
246
  - Added support for Doorkeeper
220
247
  - Added options to `visitable`
221
248
  - Added `landing_params` method
222
249
 
223
- ## 0.1.4
250
+ ## 0.1.4 (2014-04-27)
224
251
 
225
252
  - Added `ahoy.ready()` and `ahoy.log()` for events
226
253
 
227
- ## 0.1.3
254
+ ## 0.1.3 (2014-04-24)
228
255
 
229
256
  - Supports `current_user` from `ApplicationController`
230
257
  - Added `ahoy.reset()`
@@ -232,16 +259,16 @@ Breaking changes
232
259
  - Added experimental support for native apps
233
260
  - Prefer `ahoy` over `Ahoy`
234
261
 
235
- ## 0.1.2
262
+ ## 0.1.2 (2014-04-15)
236
263
 
237
264
  - Attach user on Devise sign up
238
265
  - Ability to specify visit model
239
266
 
240
- ## 0.1.1
267
+ ## 0.1.1 (2014-03-20)
241
268
 
242
269
  - Made most database columns optional
243
270
  - Performance hack for referer-parser
244
271
 
245
- ## 0.1.0
272
+ ## 0.1.0 (2014-03-19)
246
273
 
247
274
  - First major release
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Ahoy
2
2
 
3
- :fire: Simple, powerful analytics for Rails
3
+ :fire: Simple, powerful, first-party analytics for Rails
4
4
 
5
5
  Track visits and events in Ruby, JavaScript, and native apps. Data is stored in your database by default so you can easily combine it with other data.
6
6
 
7
- :postbox: To track emails, check out [Ahoy Email](https://github.com/ankane/ahoy_email), and for A/B testing, check out [Field Test](https://github.com/ankane/field_test)
7
+ :postbox: Check out [Ahoy Email](https://github.com/ankane/ahoy_email) for emails and [Field Test](https://github.com/ankane/field_test) for A/B testing
8
8
 
9
9
  :tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
10
10
 
@@ -31,12 +31,12 @@ Restart your web server, open a page in your browser, and a visit will be create
31
31
  Track your first event from a controller with:
32
32
 
33
33
  ```ruby
34
- ahoy.track "My first event", {language: "Ruby"}
34
+ ahoy.track "My first event", language: "Ruby"
35
35
  ```
36
36
 
37
37
  ### JavaScript, Native Apps, & AMP
38
38
 
39
- First, enable the API in `config/initializers/ahoy.rb`:
39
+ Enable the API in `config/initializers/ahoy.rb`:
40
40
 
41
41
  ```ruby
42
42
  Ahoy.api = true
@@ -44,7 +44,9 @@ Ahoy.api = true
44
44
 
45
45
  And restart your web server.
46
46
 
47
- For JavaScript and Rails 6 / Webpacker, run:
47
+ ### JavaScript
48
+
49
+ For Rails 6 / Webpacker, run:
48
50
 
49
51
  ```sh
50
52
  yarn add ahoy.js
@@ -56,7 +58,7 @@ And add to `app/javascript/packs/application.js`:
56
58
  import ahoy from "ahoy.js";
57
59
  ```
58
60
 
59
- For JavaScript and Rails 5 / Sprockets, add to `app/assets/javascripts/application.js`:
61
+ For Rails 5 / Sprockets, add to `app/assets/javascripts/application.js`:
60
62
 
61
63
  ```javascript
62
64
  //= require ahoy
@@ -68,14 +70,6 @@ Track an event with:
68
70
  ahoy.track("My second event", {language: "JavaScript"});
69
71
  ```
70
72
 
71
- For Android, check out [Ahoy Android](https://github.com/instacart/ahoy-android). For other platforms, see the [API spec](#api-spec).
72
-
73
- For AMP, track an event with:
74
-
75
- ```erb
76
- <%= amp_event "My third event", language: "AMP" %>
77
- ```
78
-
79
73
  ### GDPR Compliance
80
74
 
81
75
  Ahoy provides a number of options to help with GDPR compliance. See the [GDPR section](#gdpr-compliance-1) for more info.
@@ -86,9 +80,9 @@ Ahoy provides a number of options to help with GDPR compliance. See the [GDPR se
86
80
 
87
81
  When someone visits your website, Ahoy creates a visit with lots of useful information.
88
82
 
89
- - **traffic source** - referrer, referring domain, landing page, search keyword
90
- - **location** - country, region, and city
91
- - **technology** - browser, OS, and device type
83
+ - **traffic source** - referrer, referring domain, landing page
84
+ - **location** - country, region, city, latitude, longitude
85
+ - **technology** - browser, OS, device type
92
86
  - **utm parameters** - source, medium, term, content, campaign
93
87
 
94
88
  Use the `current_visit` method to access it.
@@ -113,23 +107,7 @@ Ahoy.server_side_visits = :when_needed
113
107
 
114
108
  ### Events
115
109
 
116
- Each event has a `name` and `properties`.
117
-
118
- There are several ways to track events.
119
-
120
- #### JavaScript
121
-
122
- ```javascript
123
- ahoy.track("Viewed book", {title: "The World is Flat"});
124
- ```
125
-
126
- or track events automatically with:
127
-
128
- ```javascript
129
- ahoy.trackAll();
130
- ```
131
-
132
- See [Ahoy.js](https://github.com/ankane/ahoy.js) for a complete list of features.
110
+ Each event has a `name` and `properties`. There are several ways to track events.
133
111
 
134
112
  #### Ruby
135
113
 
@@ -137,7 +115,7 @@ See [Ahoy.js](https://github.com/ankane/ahoy.js) for a complete list of features
137
115
  ahoy.track "Viewed book", title: "Hot, Flat, and Crowded"
138
116
  ```
139
117
 
140
- or track actions automatically with:
118
+ Track actions automatically with:
141
119
 
142
120
  ```ruby
143
121
  class ApplicationController < ActionController::Base
@@ -151,6 +129,20 @@ class ApplicationController < ActionController::Base
151
129
  end
152
130
  ```
153
131
 
132
+ #### JavaScript
133
+
134
+ ```javascript
135
+ ahoy.track("Viewed book", {title: "The World is Flat"});
136
+ ```
137
+
138
+ Track events automatically with:
139
+
140
+ ```javascript
141
+ ahoy.trackAll();
142
+ ```
143
+
144
+ See [Ahoy.js](https://github.com/ankane/ahoy.js) for a complete list of features.
145
+
154
146
  #### Native Apps
155
147
 
156
148
  For Android, check out [Ahoy Android](https://github.com/instacart/ahoy-android). For other platforms, see the [API spec](#api-spec).
@@ -189,7 +181,7 @@ Order.joins(:ahoy_visit).group("device_type").count
189
181
  Here’s what the migration to add the `ahoy_visit_id` column should look like:
190
182
 
191
183
  ```ruby
192
- class AddVisitIdToOrders < ActiveRecord::Migration[5.2]
184
+ class AddVisitIdToOrders < ActiveRecord::Migration[6.0]
193
185
  def change
194
186
  add_column :orders, :ahoy_visit_id, :bigint
195
187
  end
@@ -300,7 +292,7 @@ By default, a new visit is created after 4 hours of inactivity. Change this with
300
292
  Ahoy.visit_duration = 30.minutes
301
293
  ```
302
294
 
303
- ### Multiple Subdomains
295
+ ### Cookies
304
296
 
305
297
  To track visits across multiple subdomains, use:
306
298
 
@@ -308,6 +300,12 @@ To track visits across multiple subdomains, use:
308
300
  Ahoy.cookie_domain = :all
309
301
  ```
310
302
 
303
+ Set other [cookie options](https://api.rubyonrails.org/classes/ActionDispatch/Cookies.html) with:
304
+
305
+ ```ruby
306
+ Ahoy.cookie_options = {same_site: :lax}
307
+ ```
308
+
311
309
  ### Geocoding
312
310
 
313
311
  Disable geocoding with:
@@ -316,7 +314,7 @@ Disable geocoding with:
316
314
  Ahoy.geocode = false
317
315
  ```
318
316
 
319
- Change the job queue with:
317
+ The default job queue is `:ahoy`. Change this with:
320
318
 
321
319
  ```ruby
322
320
  Ahoy.job_queue = :low_priority
@@ -415,6 +413,8 @@ Ahoy can mask IPs with the same approach [Google Analytics uses for IP anonymiza
415
413
  Ahoy.mask_ips = true
416
414
  ```
417
415
 
416
+ IPs are masked before geolocation is performed.
417
+
418
418
  To mask previously collected IPs, use:
419
419
 
420
420
  ```ruby
@@ -433,6 +433,28 @@ Ahoy.cookies = false
433
433
 
434
434
  Previously set cookies are automatically deleted.
435
435
 
436
+ ## Data Retention
437
+
438
+ Delete older data with:
439
+
440
+ ```ruby
441
+ Ahoy::Visit.where("started_at < ?", 2.years.ago).find_in_batches do |visits|
442
+ visit_ids = visits.map(&:id)
443
+ Ahoy::Event.where(visit_id: visit_ids).delete_all
444
+ Ahoy::Visit.where(id: visit_ids).delete_all
445
+ end
446
+ ```
447
+
448
+ Delete data for a specific user with:
449
+
450
+ ```ruby
451
+ user_id = 123
452
+ visit_ids = Ahoy::Visit.where(user_id: user_id).pluck(:id)
453
+ Ahoy::Event.where(visit_id: visit_ids).delete_all
454
+ Ahoy::Visit.where(id: visit_ids).delete_all
455
+ Ahoy::Event.where(user_id: user_id).delete_all
456
+ ```
457
+
436
458
  ## Development
437
459
 
438
460
  Ahoy is built with developers in mind. You can run the following code in your browser’s console.
@@ -507,7 +529,7 @@ end
507
529
 
508
530
  Two useful methods you can use are `request` and `controller`.
509
531
 
510
- You can pass additional visit data from JavaScript with: [master]
532
+ You can pass additional visit data from JavaScript with:
511
533
 
512
534
  ```javascript
513
535
  ahoy.configure({visitParams: {referral_code: 123}});
@@ -631,6 +653,21 @@ Send a `POST` request to `/ahoy/events` with `Content-Type: application/json` an
631
653
 
632
654
  ## Upgrading
633
655
 
656
+ ### 3.0
657
+
658
+ If you installed Ahoy before 2.1 and want to keep legacy user agent parsing and bot detection, add to your Gemfile:
659
+
660
+ ```ruby
661
+ gem "browser", "~> 2.0"
662
+ gem "user_agent_parser"
663
+ ```
664
+
665
+ And add to `config/initializers/ahoy.rb`:
666
+
667
+ ```ruby
668
+ Ahoy.user_agent_parser = :legacy
669
+ ```
670
+
634
671
  ### 2.2
635
672
 
636
673
  Ahoy now ships with better bot detection if you use Device Detector. This should be more accurate but can significantly reduce the number of visits recorded. For existing installs, it’s opt-in to start. To use it, add to `config/initializers/ahoy.rb`: