rails_local_analytics 0.2.2 → 0.2.4
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beaf062a7a9dbc3b7f1719e7a271614f634fde67672a245346412eb4d1a78bdd
|
4
|
+
data.tar.gz: c794bcccb049f4ced030c232056687967c7aabe278886cff198b71933dcd5c85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52a06c2a88d8f3f603e693f19ed6edcc0c5d8d27d0d5ba04dd8b438ad5c40f71d7dfe00fb0dcb138f0ee57a0f63885dfa7b7c51509fd6ef605bbb8a2fe57361e
|
7
|
+
data.tar.gz: 074f789a04d5c0f58d52c404362c9169f77ed5da367af4094001a571d8396927b4f8a59913223ce039f3179ab984f793d39699db27aea1d899e08f68a40f099f
|
data/README.md
CHANGED
@@ -73,6 +73,7 @@ class CreateAnalyticsTables < ActiveRecord::Migration[6.0]
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
```
|
76
|
+
The reason we store our analytics in two separate tables to keep the cardinality of our data low. You are permitted to store everything in only one table but I recommend you try the 2 table approach first and see if it meets your needs. See the performance optimization section for more details.
|
76
77
|
|
77
78
|
Add the route for the analytics dashboard at the desired endpoint:
|
78
79
|
|
@@ -81,11 +82,11 @@ Add the route for the analytics dashboard at the desired endpoint:
|
|
81
82
|
mount RailsLocalAnalytics::Engine, at: "/admin/analytics"
|
82
83
|
```
|
83
84
|
|
84
|
-
Its generally recomended to use a background job (especially since we now have [`solid_queue`](https://github.com/rails/solid_queue/)). If you would like to disable background jobs you can use the following config:
|
85
|
+
Its generally recomended to use a background job (especially since we now have [`solid_queue`](https://github.com/rails/solid_queue/)). If you would like to disable background jobs you can use the following config option:
|
85
86
|
|
86
87
|
```ruby
|
87
88
|
# config/initializers/rails_local_analytics.rb
|
88
|
-
RailsLocalAnalytics.config.background_jobs = false # defaults to true
|
89
|
+
# RailsLocalAnalytics.config.background_jobs = false # defaults to true
|
89
90
|
```
|
90
91
|
|
91
92
|
The next step is to collect traffic.
|
@@ -157,6 +158,7 @@ There are a few techniques that you can use to tailor the database for your part
|
|
157
158
|
* Consider just storing "local" or nil instead if the request originated from your website
|
158
159
|
- `platform` and `browser_engine` columns
|
159
160
|
* Consider dropping either of these if you do not need this information
|
161
|
+
- If you want to store everything in one table (which I dont think most people actually need) then you can simply only create one table (I recommend `tracked_requests_by_day_page`) with all of the fields from both tables. This gem will automatically populate all the same fields. You should NOT need to use `:custom_attributes` in this scenario.
|
160
162
|
|
161
163
|
## Usage where a request object is not available
|
162
164
|
|
File without changes
|
File without changes
|
@@ -29,7 +29,7 @@ module RailsLocalAnalytics
|
|
29
29
|
json_str = JSON.generate(json_hash) # convert to json string so that its compatible with all job backends
|
30
30
|
RecordRequestJob.perform_later(json_str)
|
31
31
|
else
|
32
|
-
RecordRequestJob.new.perform(json_hash)
|
32
|
+
RecordRequestJob.new.perform(json_hash.deep_stringify_keys)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -44,12 +44,19 @@ module RailsLocalAnalytics
|
|
44
44
|
end
|
45
45
|
|
46
46
|
class Config
|
47
|
-
|
47
|
+
DEFAULTS = {
|
48
|
+
background_jobs: true,
|
49
|
+
}.freeze
|
50
|
+
|
48
51
|
mattr_reader :background_jobs
|
49
52
|
|
50
53
|
def self.background_jobs=(val)
|
51
54
|
@@background_jobs = !!val
|
52
55
|
end
|
56
|
+
|
57
|
+
DEFAULTS.each do |k,v|
|
58
|
+
self.send("#{k}=", v)
|
59
|
+
end
|
53
60
|
end
|
54
61
|
|
55
62
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_local_analytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weston Ganger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -106,6 +106,8 @@ files:
|
|
106
106
|
- README.md
|
107
107
|
- Rakefile
|
108
108
|
- app/assets/config/rails_local_analytics_manifest.js
|
109
|
+
- app/assets/images/rails_local_analytics/.keep
|
110
|
+
- app/assets/javascripts/rails_local_analytics/.keep
|
109
111
|
- app/assets/stylesheets/rails_local_analytics/application.css
|
110
112
|
- app/controllers/rails_local_analytics/application_controller.rb
|
111
113
|
- app/controllers/rails_local_analytics/dashboard_controller.rb
|