card-mod-google_analytics 0.12.0 → 0.13.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/set/all/google_analytics.rb +30 -15
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea5365988b1e431266ede0e1117ecbbde8d9f713a4ab180987afd1d5e7ef3947
|
4
|
+
data.tar.gz: 6c627278d34cdeaef86d3b5544144c46a4b73efecb71de2786894e6cedf5c867
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a771080f51e99419c93cce722f01966215674b0c2739624bf2eeb5bece9148ee7a2089f32f77f8c2c6993ada86f56f4c1d2116ce5eed55de75ce64191e538f6a
|
7
|
+
data.tar.gz: c0df36197a97bf9d9e3525424392efcfae7bb040af168791114abbdae081349e814cd839807443a77df41100a0a1aeabfcdd10006581907c33ad5d5fcc1ea1bd
|
data/set/all/google_analytics.rb
CHANGED
@@ -1,32 +1,47 @@
|
|
1
1
|
require "staccato"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
event :track_page, before: :show_page, when: :track_page_from_server? do
|
4
|
+
track_page!
|
5
|
+
end
|
6
6
|
|
7
|
-
|
8
|
-
tracker.pageview
|
7
|
+
def track_page!
|
8
|
+
tracker.pageview tracker_options
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
# TODO: optimize so it doesn't keep doing lookup if there is no key.
|
12
|
+
def google_analytics_key
|
13
|
+
@google_analytics_key ||=
|
14
|
+
Card::Rule.global_setting(:google_analytics_key) ||
|
15
|
+
Card.config.google_analytics_key
|
14
16
|
end
|
15
17
|
|
16
18
|
def tracker
|
17
|
-
|
19
|
+
tracker_key && ::Staccato.tracker(tracker_key) # , nil, ssl: true
|
20
|
+
end
|
18
21
|
|
19
|
-
|
22
|
+
# can override to have separate keys for web and API
|
23
|
+
def tracker_key
|
24
|
+
google_analytics_key
|
20
25
|
end
|
21
26
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
|
27
|
+
def tracker_options
|
28
|
+
r = Env.controller.request
|
29
|
+
{
|
30
|
+
path: r.path,
|
31
|
+
host: Env.host,
|
32
|
+
title: name,
|
33
|
+
user_id: Auth.current_id,
|
34
|
+
user_ip: r.remote_ip
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# for override
|
39
|
+
def track_page_from_server?
|
40
|
+
false
|
26
41
|
end
|
27
42
|
|
28
43
|
format :html do
|
29
|
-
delegate :
|
44
|
+
delegate :google_analytics_key, to: :card
|
30
45
|
|
31
46
|
def views_in_head
|
32
47
|
super << :google_analytics_snippet
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-google_analytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-09-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.103.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.
|
28
|
+
version: 1.103.3
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: staccato
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
|
-
rubygems_version: 3.
|
78
|
+
rubygems_version: 3.1.6
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: Google Analytics support for decko
|