gaevents 1.0 → 1.01
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 +4 -4
- data/README.md +3 -6
- data/lib/gaevents.rb +2 -2
- data/lib/gaevents/event.rb +3 -3
- data/lib/gaevents/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f0e24d97a555e4fc17be9bc3198e1f83da84c1d2
|
|
4
|
+
data.tar.gz: 6261563bc25a75636844dde942e80916a5327839
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4580d7e22ef921036044f3086ea16800fb4bda09bc85659b7eaaa4bf5d94e3f40768fbab72078af3bc3298690a1dd200c7f907e01211b7fe2341c194508ae6e2
|
|
7
|
+
data.tar.gz: 6ebdf0646339f45fcf65cb45bf844ba338c21f98f94bce219c572605d7e9496c900e0b65546eb9698855e467b6338470476b8acc85291b66fd799d23f27bbd14
|
data/README.md
CHANGED
|
@@ -25,15 +25,12 @@ Or install it yourself as:
|
|
|
25
25
|
Please refer [Measurement Protocol Parameter Reference](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters) for the list of all parameters accepted by the Protocol.
|
|
26
26
|
|
|
27
27
|
The following parameters are required in each event:
|
|
28
|
-
`v`, `tid`, `cid` and `t`. This gem automatically injects `v
|
|
28
|
+
`v`, `tid`, `cid` and `t`. This gem automatically injects `v`, make sure all events have `tid`, `cid` and `t` as parameters.
|
|
29
29
|
|
|
30
30
|
```
|
|
31
|
-
# configure your application's API key
|
|
32
|
-
GAEvents.api_key = "UA-XXXXX-Y"
|
|
33
|
-
|
|
34
31
|
events = []
|
|
35
32
|
10.times { |n|
|
|
36
|
-
events << GAEvents::Event.new({cid: "ci#{n}", t: 'event', ec: "video#{n}", ea: "abc#{n}", uid: "user#{n}"})
|
|
33
|
+
events << GAEvents::Event.new({tid: GATRACKINGID, cid: "ci#{n}", t: 'event', ec: "video#{n}", ea: "abc#{n}", uid: "user#{n}"})
|
|
37
34
|
}
|
|
38
35
|
GAEvents.track(events)
|
|
39
36
|
```
|
|
@@ -46,7 +43,7 @@ GAEvents::Event.new(GOOGLE_API_CLIENT_ID, "testcategory", "gaaction")
|
|
|
46
43
|
```
|
|
47
44
|
1.x now accepts a hash that can have any number of acceptable parameters. The above line of code then becomes:
|
|
48
45
|
```
|
|
49
|
-
|
|
46
|
+
GAEvents::Event.new({tid: GATRACKINGID, cid: GOOGLE_API_CLIENT_ID, ec: "testcategory", ea: "gaaction"})
|
|
50
47
|
```
|
|
51
48
|
|
|
52
49
|
## Development
|
data/lib/gaevents.rb
CHANGED
|
@@ -4,7 +4,7 @@ require_relative "gaevents/event"
|
|
|
4
4
|
|
|
5
5
|
class GAEvents
|
|
6
6
|
BULK_URI = 'https://www.google-analytics.com/batch'.freeze
|
|
7
|
-
COLLECT_URI = 'https://www.google-analytics.com/
|
|
7
|
+
COLLECT_URI = 'https://www.google-analytics.com/collect'.freeze
|
|
8
8
|
|
|
9
9
|
class << self
|
|
10
10
|
attr_accessor :api_key
|
|
@@ -26,7 +26,7 @@ class GAEvents
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def track_body(*events)
|
|
29
|
-
events.flatten.map
|
|
29
|
+
events.flatten.map(&:payload).join("\n")
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
data/lib/gaevents/event.rb
CHANGED
|
@@ -8,15 +8,15 @@ class GAEvents
|
|
|
8
8
|
# https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
|
|
9
9
|
|
|
10
10
|
# As per Measurement Protocol, parameters: v, tid, cid and t should always be present.
|
|
11
|
-
# This gem automatically injects v
|
|
11
|
+
# This gem automatically injects v. Ensure you always pass tid, cid and t while
|
|
12
12
|
# initializing events.
|
|
13
13
|
def initialize(hash = {})
|
|
14
14
|
@params = hash.reject { |k,v| !v }
|
|
15
15
|
@params["v"] = 1
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def payload
|
|
19
|
-
URI.encode_www_form(@params
|
|
18
|
+
def payload
|
|
19
|
+
URI.encode_www_form(@params)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
end
|
data/lib/gaevents/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gaevents
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '1.
|
|
4
|
+
version: '1.01'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- singhshivam
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-12-
|
|
11
|
+
date: 2017-12-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|