rack-tracker 1.11.1 → 1.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -0
- data/lib/rack/tracker/google_analytics/google_analytics.rb +5 -0
- data/lib/rack/tracker/google_analytics/template/google_analytics.erb +1 -1
- data/lib/rack/tracker/version.rb +1 -1
- data/spec/handler/google_analytics_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a22c7f5dec27b8abd60ab5a9cbd1161e336c0063fa2d0171db5d7795a3b79024
|
4
|
+
data.tar.gz: 41d811bf5ee13c120791703df76b805a2095a5c517cb763338cf807d0c776e6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2d88b11dc5d33c7639dc41058832ef5e8ca8b06121e46b72dfe08697e7b990b8588f3c50b6f30aa9fe094cd37bbcd42cfa87de71d769c2e8d2c088417149366
|
7
|
+
data.tar.gz: 6067ba21908d7724eaf70a77d06887af81486315604dca450ea8740039625d4858f517ef4791617eb03918b250bd59e82a5122a982ebeba7f0d15dd1cfdc2639
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -140,6 +140,7 @@ end
|
|
140
140
|
* `:enhanced_ecommerce` - Enables [Enhanced Ecommerce Tracking](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce)
|
141
141
|
* `:optimize` - pass [Google Optimize container ID](https://support.google.com/360suite/optimize/answer/6262084#example-combined-snippet) as value (e.g. `optimize: 'GTM-1234'`).
|
142
142
|
* `:pageview_url_script` - a String containing a custom js script evaluating to the url that shoudl be given to the pageview event. Default to `window.location.pathname + window.location.search`.
|
143
|
+
* `:explicit_pageview` - A boolean that controls whether to send the `pageview` event on pageload. This defaults to true.
|
143
144
|
|
144
145
|
#### Events
|
145
146
|
|
@@ -2,6 +2,11 @@ class Rack::Tracker::GoogleAnalytics < Rack::Tracker::Handler
|
|
2
2
|
|
3
3
|
self.allowed_tracker_options = [:cookie_domain, :user_id]
|
4
4
|
|
5
|
+
def initialize(env, options = {})
|
6
|
+
options[:explicit_pageview] = true if !options.has_key?(:explicit_pageview)
|
7
|
+
super(env, options)
|
8
|
+
end
|
9
|
+
|
5
10
|
class Send < OpenStruct
|
6
11
|
def initialize(attrs = {})
|
7
12
|
attrs.reverse_merge!(type: 'event')
|
data/lib/rack/tracker/version.rb
CHANGED
@@ -284,5 +284,21 @@ RSpec.describe Rack::Tracker::GoogleAnalytics do
|
|
284
284
|
expect(subject.pageview_url_script).to eql ("{ 'page': location.pathname + location.search + location.hash }")
|
285
285
|
end
|
286
286
|
end
|
287
|
+
|
288
|
+
context 'with explicit_pageview disabled' do
|
289
|
+
subject { described_class.new(env, {tracker: 'afake', explicit_pageview: false }).render }
|
290
|
+
|
291
|
+
it 'does not send a pageview event' do
|
292
|
+
expect(subject).not_to include %q{ga('send', 'pageview',}
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
context 'defaults to sending the pageview event' do
|
297
|
+
subject { described_class.new(env, {tracker: 'afake'}).render }
|
298
|
+
|
299
|
+
it 'does not send a pageview event' do
|
300
|
+
expect(subject).to include "ga('send', 'pageview'"
|
301
|
+
end
|
302
|
+
end
|
287
303
|
end
|
288
304
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-tracker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lars Brillert
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-08-
|
12
|
+
date: 2019-08-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|