ahoy_matey 5.4.0 → 5.5.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/LICENSE.txt +1 -1
- data/README.md +3 -29
- data/app/controllers/ahoy/base_controller.rb +2 -1
- data/lib/ahoy/tracker.rb +12 -5
- data/lib/ahoy/version.rb +1 -1
- data/lib/generators/ahoy/install_generator.rb +5 -5
- data/vendor/assets/javascripts/ahoy.js +2 -2
- metadata +19 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 44d4e5d43d7fad25db6c27bc9bdfcefa0a4226be502b312a53aa6ad845f17d4d
|
|
4
|
+
data.tar.gz: 51798d1dd69a5f42f64dc18d3195d8ad80fe85568c78d839c470d708bfc6b18a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78fceba09807aa17acf80c2c6d61d10b4eb9f8318780650f07714d0307864c417003084de42a6f856065e46cf977743aab0e5008f308924c741e4ecc786db3c7
|
|
7
|
+
data.tar.gz: e0603191b7a45e2835617b7b32c6d59aaa00f04dd641683a5fd0b8a4b841422819d51b124b93f9f0b6301dbbdc80a3dabdf1928fc21c0119930002a07c07d7cf
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 5.5.0 (2026-04-08)
|
|
2
|
+
|
|
3
|
+
- Fixed error with `Ahoy::Tracker` outside of requests
|
|
4
|
+
- Dropped support for Ruby < 3.3 and Rails < 7.2
|
|
5
|
+
|
|
6
|
+
## 5.4.2 (2026-03-31)
|
|
7
|
+
|
|
8
|
+
- Fixed cookie deletion with `cookie_domain` and `cookie_options` options
|
|
9
|
+
- Updated Ahoy.js to 0.4.5
|
|
10
|
+
|
|
11
|
+
## 5.4.1 (2025-09-30)
|
|
12
|
+
|
|
13
|
+
- Fixed deprecation warning with Rack 3.1+
|
|
14
|
+
|
|
1
15
|
## 5.4.0 (2025-05-04)
|
|
2
16
|
|
|
3
17
|
- Dropped support for Ruby < 3.2 and Rails < 7.1
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -46,7 +46,7 @@ And restart your web server.
|
|
|
46
46
|
|
|
47
47
|
### JavaScript
|
|
48
48
|
|
|
49
|
-
For Importmap (Rails
|
|
49
|
+
For Importmap (Rails default), add to `config/importmap.rb`:
|
|
50
50
|
|
|
51
51
|
```ruby
|
|
52
52
|
pin "ahoy", to: "ahoy.js"
|
|
@@ -197,7 +197,7 @@ Order.joins(:ahoy_visit).group("device_type").count
|
|
|
197
197
|
Here’s what the migration to add the `ahoy_visit_id` column should look like:
|
|
198
198
|
|
|
199
199
|
```ruby
|
|
200
|
-
class AddAhoyVisitToOrders < ActiveRecord::Migration[8.
|
|
200
|
+
class AddAhoyVisitToOrders < ActiveRecord::Migration[8.1]
|
|
201
201
|
def change
|
|
202
202
|
add_reference :orders, :ahoy_visit
|
|
203
203
|
end
|
|
@@ -490,7 +490,7 @@ Ahoy can switch from cookies to [anonymity sets](https://privacypatterns.org/pat
|
|
|
490
490
|
Ahoy.cookies = :none
|
|
491
491
|
```
|
|
492
492
|
|
|
493
|
-
Note: If Ahoy was installed before v5, [add an index](#50) before making this change.
|
|
493
|
+
Note: If Ahoy was installed before v5, [add an index](https://github.com/ankane/ahoy/tree/v5.0.0?tab=readme-ov-file#50) before making this change.
|
|
494
494
|
|
|
495
495
|
Previously set cookies are automatically deleted. If you use JavaScript tracking, also set:
|
|
496
496
|
|
|
@@ -771,32 +771,6 @@ Send a `POST` request to `/ahoy/events` with `Content-Type: application/json` an
|
|
|
771
771
|
}
|
|
772
772
|
```
|
|
773
773
|
|
|
774
|
-
## Upgrading
|
|
775
|
-
|
|
776
|
-
### 5.0
|
|
777
|
-
|
|
778
|
-
Visits now expire with anonymity sets. If using `Ahoy.cookies = false`, a new index is needed.
|
|
779
|
-
|
|
780
|
-
For Active Record, create a migration with:
|
|
781
|
-
|
|
782
|
-
```ruby
|
|
783
|
-
add_index :ahoy_visits, [:visitor_token, :started_at]
|
|
784
|
-
```
|
|
785
|
-
|
|
786
|
-
For Mongoid, set:
|
|
787
|
-
|
|
788
|
-
```ruby
|
|
789
|
-
class Ahoy::Visit
|
|
790
|
-
index({visitor_token: 1, started_at: 1})
|
|
791
|
-
end
|
|
792
|
-
```
|
|
793
|
-
|
|
794
|
-
Create the index before upgrading, and set:
|
|
795
|
-
|
|
796
|
-
```ruby
|
|
797
|
-
Ahoy.cookies = :none
|
|
798
|
-
```
|
|
799
|
-
|
|
800
774
|
## History
|
|
801
775
|
|
|
802
776
|
View the [changelog](https://github.com/ankane/ahoy/blob/master/CHANGELOG.md)
|
|
@@ -36,7 +36,8 @@ module Ahoy
|
|
|
36
36
|
def verify_request_size
|
|
37
37
|
if request.content_length > Ahoy.max_content_length
|
|
38
38
|
logger.info "[ahoy] Payload too large"
|
|
39
|
-
|
|
39
|
+
status = Rack::RELEASE.to_f >= 3.1 ? :content_too_large : :payload_too_large
|
|
40
|
+
render plain: "Payload too large\n", status: status
|
|
40
41
|
end
|
|
41
42
|
end
|
|
42
43
|
end
|
data/lib/ahoy/tracker.rb
CHANGED
|
@@ -43,7 +43,7 @@ module Ahoy
|
|
|
43
43
|
if defer
|
|
44
44
|
set_cookie("ahoy_track", true, nil, false)
|
|
45
45
|
else
|
|
46
|
-
delete_cookie("ahoy_track")
|
|
46
|
+
delete_cookie("ahoy_track", false)
|
|
47
47
|
|
|
48
48
|
data = {
|
|
49
49
|
visit_token: visit_token,
|
|
@@ -142,7 +142,7 @@ module Ahoy
|
|
|
142
142
|
def reset_visit
|
|
143
143
|
delete_cookie("ahoy_visit")
|
|
144
144
|
delete_cookie("ahoy_events")
|
|
145
|
-
delete_cookie("ahoy_track")
|
|
145
|
+
delete_cookie("ahoy_track", false)
|
|
146
146
|
end
|
|
147
147
|
|
|
148
148
|
def exclude?
|
|
@@ -179,8 +179,15 @@ module Ahoy
|
|
|
179
179
|
request.cookie_jar[name] = cookie
|
|
180
180
|
end
|
|
181
181
|
|
|
182
|
-
def delete_cookie(name)
|
|
183
|
-
|
|
182
|
+
def delete_cookie(name, use_domain = true)
|
|
183
|
+
if request && request.cookie_jar[name]
|
|
184
|
+
options = Ahoy.cookie_options.slice(:path)
|
|
185
|
+
if use_domain
|
|
186
|
+
domain = Ahoy.cookie_options[:domain] || Ahoy.cookie_domain
|
|
187
|
+
options[:domain] = domain if domain
|
|
188
|
+
end
|
|
189
|
+
request.cookie_jar.delete(name, **options)
|
|
190
|
+
end
|
|
184
191
|
end
|
|
185
192
|
|
|
186
193
|
def trusted_time(time = nil)
|
|
@@ -241,7 +248,7 @@ module Ahoy
|
|
|
241
248
|
end
|
|
242
249
|
|
|
243
250
|
def visitor_anonymity_set
|
|
244
|
-
@visitor_anonymity_set ||= Digest::UUID.uuid_v5(UUID_NAMESPACE, ["visitor", Ahoy.mask_ip(request.remote_ip), request.user_agent].join("/"))
|
|
251
|
+
@visitor_anonymity_set ||= request && Digest::UUID.uuid_v5(UUID_NAMESPACE, ["visitor", Ahoy.mask_ip(request.remote_ip), request.user_agent].join("/"))
|
|
245
252
|
end
|
|
246
253
|
|
|
247
254
|
def visit_cookie
|
data/lib/ahoy/version.rb
CHANGED
|
@@ -11,12 +11,12 @@ module Ahoy
|
|
|
11
11
|
|
|
12
12
|
selection =
|
|
13
13
|
if activerecord && mongoid
|
|
14
|
-
puts
|
|
14
|
+
puts <<~MSG
|
|
15
15
|
|
|
16
|
-
Which data store would you like to use?
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
Which data store would you like to use?
|
|
17
|
+
1. ActiveRecord (default)
|
|
18
|
+
2. Mongoid
|
|
19
|
+
3. Neither
|
|
20
20
|
MSG
|
|
21
21
|
|
|
22
22
|
ask(">")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Ahoy.js v0.4.
|
|
2
|
+
* Ahoy.js v0.4.5
|
|
3
3
|
* Simple, powerful JavaScript analytics
|
|
4
4
|
* https://github.com/ankane/ahoy.js
|
|
5
5
|
* MIT License
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
function destroyCookie(name) {
|
|
122
|
-
Cookies.set(name, "", -1);
|
|
122
|
+
Cookies.set(name, "", -1, config.cookieDomain || config.domain);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
function log(message) {
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ahoy_matey
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
@@ -15,14 +15,28 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '7.
|
|
18
|
+
version: '7.2'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '7.
|
|
25
|
+
version: '7.2'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: cgi
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
26
40
|
- !ruby/object:Gem::Dependency
|
|
27
41
|
name: device_detector
|
|
28
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -102,14 +116,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
102
116
|
requirements:
|
|
103
117
|
- - ">="
|
|
104
118
|
- !ruby/object:Gem::Version
|
|
105
|
-
version: '3.
|
|
119
|
+
version: '3.3'
|
|
106
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
121
|
requirements:
|
|
108
122
|
- - ">="
|
|
109
123
|
- !ruby/object:Gem::Version
|
|
110
124
|
version: '0'
|
|
111
125
|
requirements: []
|
|
112
|
-
rubygems_version:
|
|
126
|
+
rubygems_version: 4.0.6
|
|
113
127
|
specification_version: 4
|
|
114
128
|
summary: Simple, powerful, first-party analytics for Rails
|
|
115
129
|
test_files: []
|