ahoy_matey 4.0.2 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/LICENSE.txt +1 -1
- data/README.md +26 -18
- data/app/jobs/ahoy/geocode_job.rb +1 -0
- data/lib/ahoy/database_store.rb +6 -1
- data/lib/ahoy/engine.rb +2 -2
- data/lib/ahoy/tracker.rb +4 -1
- data/lib/ahoy/version.rb +1 -1
- data/lib/ahoy.rb +0 -1
- data/lib/generators/ahoy/activerecord_generator.rb +1 -0
- data/lib/generators/ahoy/templates/mongoid_event_model.rb.tt +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 021c0b07d7cddf6a22125683bb5b1d18a078f1ff1f504cca066d4069c6014357
|
4
|
+
data.tar.gz: d49b52ce94f4c7436df4d054324639f9e5cd951fe459a11ca28aaab36231bd19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6082fea0363bb2f25b7309876a36a1982894d3dcc2dc905da2278ab0ca41257f1c322001c86deb36168dbd1649c87199ec65990c9e7307b407b3f96fdb7a2bac
|
7
|
+
data.tar.gz: d833375e6cdb800b51072ed3d3c269e55c21c06287cde4a351022c331b36dd4b9aa812afa7b33156ee7a7b745d08a53b0d726000a919fd616300c0f6149a51b4
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 4.1.0 (2022-06-12)
|
2
|
+
|
3
|
+
- Ensure `exclude_method` is only called once per request
|
4
|
+
- Fixed error with Mongoid when `Mongoid.raise_not_found_error` is `true`
|
5
|
+
- Fixed association for Mongoid
|
6
|
+
|
7
|
+
## 4.0.3 (2022-01-15)
|
8
|
+
|
9
|
+
- Support for `importmap-rails` is no longer experimental
|
10
|
+
- Fixed asset precompilation error with `importmap-rails`
|
11
|
+
|
1
12
|
## 4.0.2 (2021-11-06)
|
2
13
|
|
3
14
|
- Added experimental support for `importmap-rails`
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -17,7 +17,7 @@ Track visits and events in Ruby, JavaScript, and native apps. Data is stored in
|
|
17
17
|
Add this line to your application’s Gemfile:
|
18
18
|
|
19
19
|
```ruby
|
20
|
-
gem
|
20
|
+
gem "ahoy_matey"
|
21
21
|
```
|
22
22
|
|
23
23
|
And run:
|
@@ -48,6 +48,18 @@ And restart your web server.
|
|
48
48
|
|
49
49
|
### JavaScript
|
50
50
|
|
51
|
+
For Rails 7 / Importmap, add to `config/importmap.rb`:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
pin "ahoy", to: "ahoy.js"
|
55
|
+
```
|
56
|
+
|
57
|
+
And add to `app/javascript/application.js`:
|
58
|
+
|
59
|
+
```javascript
|
60
|
+
import "ahoy"
|
61
|
+
```
|
62
|
+
|
51
63
|
For Rails 6 / Webpacker, run:
|
52
64
|
|
53
65
|
```sh
|
@@ -66,18 +78,6 @@ For Rails 5 / Sprockets, add to `app/assets/javascripts/application.js`:
|
|
66
78
|
//= require ahoy
|
67
79
|
```
|
68
80
|
|
69
|
-
For Rails 7 / Importmap (experimental), add to `config/importmap.rb`:
|
70
|
-
|
71
|
-
```ruby
|
72
|
-
pin "ahoy", to: "ahoy.js"
|
73
|
-
```
|
74
|
-
|
75
|
-
And add to `app/javascript/application.js`:
|
76
|
-
|
77
|
-
```javascript
|
78
|
-
import "ahoy"
|
79
|
-
```
|
80
|
-
|
81
81
|
Track an event with:
|
82
82
|
|
83
83
|
```javascript
|
@@ -197,9 +197,9 @@ 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
|
200
|
+
class AddAhoyVisitToOrders < ActiveRecord::Migration[7.0]
|
201
201
|
def change
|
202
|
-
|
202
|
+
add_reference :orders, :ahoy_visit
|
203
203
|
end
|
204
204
|
end
|
205
205
|
```
|
@@ -361,7 +361,7 @@ Ahoy uses [Geocoder](https://github.com/alexreisner/geocoder) for geocoding. We
|
|
361
361
|
To enable geocoding, add this line to your application’s Gemfile:
|
362
362
|
|
363
363
|
```ruby
|
364
|
-
gem
|
364
|
+
gem "geocoder"
|
365
365
|
```
|
366
366
|
|
367
367
|
And update `config/initializers/ahoy.rb`:
|
@@ -381,7 +381,7 @@ Ahoy.job_queue = :low_priority
|
|
381
381
|
For privacy and performance, we recommend geocoding locally. Add this line to your application’s Gemfile:
|
382
382
|
|
383
383
|
```ruby
|
384
|
-
gem
|
384
|
+
gem "maxminddb"
|
385
385
|
```
|
386
386
|
|
387
387
|
For city-level geocoding, download the [GeoLite2 City database](https://dev.maxmind.com/geoip/geoip2/geolite2/) and create `config/initializers/geocoder.rb` with:
|
@@ -500,6 +500,8 @@ Previously set cookies are automatically deleted. If you use JavaScript tracking
|
|
500
500
|
ahoy.configure({cookies: false});
|
501
501
|
```
|
502
502
|
|
503
|
+
Note: With anonymity sets, visits no longer expire after 4 hours of inactivity. A new visit is only created when the IP mask or user agent changes (for instance, when a user updates their browser). There are plans to address this in the next major version.
|
504
|
+
|
503
505
|
## Data Retention
|
504
506
|
|
505
507
|
Data should only be retained for as long as it’s needed. Delete older data with:
|
@@ -784,7 +786,7 @@ There are two notable changes to geocoding:
|
|
784
786
|
2. The `geocoder` gem is now an optional dependency. To use geocoding, add it to your Gemfile:
|
785
787
|
|
786
788
|
```ruby
|
787
|
-
gem
|
789
|
+
gem "geocoder"
|
788
790
|
```
|
789
791
|
|
790
792
|
Also, check out the [upgrade notes](https://github.com/ankane/ahoy.js#upgrading) for Ahoy.js.
|
@@ -811,6 +813,12 @@ bundle install
|
|
811
813
|
bundle exec rake test
|
812
814
|
```
|
813
815
|
|
816
|
+
To test Mongoid, use:
|
817
|
+
|
818
|
+
```sh
|
819
|
+
ADAPTER=mongoid bundle exec rake test
|
820
|
+
```
|
821
|
+
|
814
822
|
To test query methods, use:
|
815
823
|
|
816
824
|
```sh
|
data/lib/ahoy/database_store.rb
CHANGED
@@ -53,7 +53,12 @@ module Ahoy
|
|
53
53
|
|
54
54
|
def visit
|
55
55
|
unless defined?(@visit)
|
56
|
-
|
56
|
+
if defined?(Mongoid::Document) && visit_model < Mongoid::Document
|
57
|
+
# find_by raises error by default when not found
|
58
|
+
@visit = visit_model.where(visit_token: ahoy.visit_token).first if ahoy.visit_token
|
59
|
+
else
|
60
|
+
@visit = visit_model.find_by(visit_token: ahoy.visit_token) if ahoy.visit_token
|
61
|
+
end
|
57
62
|
end
|
58
63
|
@visit
|
59
64
|
end
|
data/lib/ahoy/engine.rb
CHANGED
data/lib/ahoy/tracker.rb
CHANGED
data/lib/ahoy/version.rb
CHANGED
data/lib/ahoy.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ahoy_matey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
|
-
rubygems_version: 3.
|
116
|
+
rubygems_version: 3.3.7
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: Simple, powerful, first-party analytics for Rails
|