ahoy_matey 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +6 -2
- data/lib/ahoy/model.rb +1 -1
- data/lib/ahoy/properties.rb +3 -1
- data/lib/ahoy/stores/kafka_store.rb +7 -5
- data/lib/ahoy/version.rb +1 -1
- data/lib/ahoy.rb +2 -3
- data/lib/generators/ahoy/stores/templates/active_record_events_migration.rb +1 -0
- data/test/properties/postgresql_hstore_test.rb +2 -0
- data/test/properties/postgresql_jsonb_test.rb +1 -0
- data/vendor/assets/javascripts/ahoy.js +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb076e85628b3c486e6d80013bf0729f8d3ab142
|
4
|
+
data.tar.gz: 3413580422d7567e36a2acb5bf678637fdadf189
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff07d818af43a63fa773cd891f08c2be04359c9c095e25bdd12e5c94e23b6164637573f82b4c7ebd265de918a7134d495f949f09be956492eb094fabcf648154
|
7
|
+
data.tar.gz: 87347e995d4145626112aa2ea8277ef3c45432c7f6f89435af8ed068dd85c5849df58740d3ffa5f6da5c583917a1894ac9bccd8c97cb142e641a7d0f81744a2a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -336,7 +336,7 @@ class ApplicationController < ActionController::Base
|
|
336
336
|
protected
|
337
337
|
|
338
338
|
def track_action
|
339
|
-
ahoy.track "Viewed #{
|
339
|
+
ahoy.track "Viewed #{controller_path}##{action_name}", params: request.path_parameters
|
340
340
|
end
|
341
341
|
end
|
342
342
|
```
|
@@ -559,6 +559,10 @@ Ahoy.throttle_limit = 100
|
|
559
559
|
Ahoy.throttle_period = 5.minutes
|
560
560
|
```
|
561
561
|
|
562
|
+
## Tutorials
|
563
|
+
|
564
|
+
- [Tracking Metrics with Ahoy and Blazer](https://gorails.com/episodes/internal-metrics-with-ahoy-and-blazer)
|
565
|
+
|
562
566
|
## Native Apps
|
563
567
|
|
564
568
|
### Visits
|
@@ -638,7 +642,7 @@ remove_column :ahoy_events, :properties_json
|
|
638
642
|
|
639
643
|
### 1.0.0
|
640
644
|
|
641
|
-
Add the following code to the end of `config/
|
645
|
+
Add the following code to the end of `config/initializers/ahoy.rb`.
|
642
646
|
|
643
647
|
```ruby
|
644
648
|
class Ahoy::Store < Ahoy::Stores::ActiveRecordTokenStore
|
data/lib/ahoy/model.rb
CHANGED
data/lib/ahoy/properties.rb
CHANGED
@@ -25,7 +25,9 @@ module Ahoy
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
when /postgres|postgis/
|
28
|
-
if column_type == :jsonb
|
28
|
+
if column_type == :jsonb
|
29
|
+
relation = relation.where("properties @> ?", properties.to_json)
|
30
|
+
elsif column_type == :json
|
29
31
|
properties.each do |k, v|
|
30
32
|
relation =
|
31
33
|
if v.nil?
|
@@ -11,17 +11,19 @@ module Ahoy
|
|
11
11
|
|
12
12
|
def client
|
13
13
|
@client ||= begin
|
14
|
-
|
15
|
-
seed_brokers: ENV["KAFKA_URL"],
|
14
|
+
Kafka.new(
|
15
|
+
seed_brokers: ENV["KAFKA_URL"] || "localhost:9092",
|
16
16
|
logger: Rails.logger
|
17
17
|
)
|
18
|
-
at_exit { client.shutdown }
|
19
|
-
client
|
20
18
|
end
|
21
19
|
end
|
22
20
|
|
23
21
|
def producer
|
24
|
-
@producer ||=
|
22
|
+
@producer ||= begin
|
23
|
+
producer = client.async_producer(delivery_interval: 3)
|
24
|
+
at_exit { producer.shutdown }
|
25
|
+
producer
|
26
|
+
end
|
25
27
|
end
|
26
28
|
|
27
29
|
def post(topic, data)
|
data/lib/ahoy/version.rb
CHANGED
data/lib/ahoy.rb
CHANGED
@@ -117,12 +117,11 @@ end
|
|
117
117
|
|
118
118
|
if defined?(Rails)
|
119
119
|
ActiveSupport.on_load(:action_controller) do
|
120
|
-
|
121
|
-
ActionController::API.send :include, Ahoy::Controller if defined?(ActionController::API)
|
120
|
+
include Ahoy::Controller
|
122
121
|
end
|
123
122
|
|
124
123
|
ActiveSupport.on_load(:active_record) do
|
125
|
-
|
124
|
+
extend Ahoy::Model
|
126
125
|
end
|
127
126
|
|
128
127
|
# ensure logger silence will not be added by activerecord-session_store
|
@@ -15,5 +15,6 @@ class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version
|
|
15
15
|
add_index :ahoy_events, [:visit_id, :name]
|
16
16
|
add_index :ahoy_events, [:user_id, :name]
|
17
17
|
add_index :ahoy_events, [:name, :time]
|
18
|
+
<% if @database == "postgresql-jsonb" && ActiveRecord::VERSION::MAJOR >= 5 %>add_index :ahoy_events, 'properties jsonb_path_ops', using: 'gin'<% end %>
|
18
19
|
end
|
19
20
|
end
|
@@ -2,6 +2,8 @@ require_relative "../test_helper"
|
|
2
2
|
|
3
3
|
ActiveRecord::Base.establish_connection adapter: "postgresql", database: "ahoy_test"
|
4
4
|
|
5
|
+
ActiveRecord::Migration.enable_extension "hstore"
|
6
|
+
|
5
7
|
ActiveRecord::Migration.create_table :postgresql_hstore_events, force: true do |t|
|
6
8
|
t.hstore :properties
|
7
9
|
end
|
@@ -4,6 +4,7 @@ ActiveRecord::Base.establish_connection adapter: "postgresql", database: "ahoy_t
|
|
4
4
|
|
5
5
|
ActiveRecord::Migration.create_table :postgresql_jsonb_events, force: true do |t|
|
6
6
|
t.jsonb :properties
|
7
|
+
t.index :properties, using: 'gin'
|
7
8
|
end
|
8
9
|
|
9
10
|
class PostgresqlJsonbEvent < PostgresqlBase
|
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: 1.6.
|
4
|
+
version: 1.6.1
|
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: 2018-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -341,7 +341,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
341
341
|
version: '0'
|
342
342
|
requirements: []
|
343
343
|
rubyforge_project:
|
344
|
-
rubygems_version: 2.
|
344
|
+
rubygems_version: 2.6.13
|
345
345
|
signing_key:
|
346
346
|
specification_version: 4
|
347
347
|
summary: Simple, powerful visit tracking for Rails
|