gaevents 1.0 → 1.01

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 725b1b06500554570c15423099e62fdb4d19eb12
4
- data.tar.gz: 8c5456f2f8fc83b2f8c6c176b90e2cae3c327f51
3
+ metadata.gz: f0e24d97a555e4fc17be9bc3198e1f83da84c1d2
4
+ data.tar.gz: 6261563bc25a75636844dde942e80916a5327839
5
5
  SHA512:
6
- metadata.gz: ddc447cd347d0b7294b475581136d0fae6b1a2d5650c54260c8f25f6af9f640fc3b296b2539f367f717bef642ca86d010ba7847cb75b6d09f972ecda282e824e
7
- data.tar.gz: ed4384d4bdced985112ae965585c401bf8e637679311bb8ccfd5f0e0109acef72c0391b5ec486bc3cfa3276dec0a54bb18f480d32a9f103b23708d69d1dbd093
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` and `tid` therefore make sure all generated events have `cid` and `t` as parameters.
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
- GAEvents::Event.new({cid: GOOGLE_API_CLIENT_ID, ec: "testcategory", ea: "gaaction"})
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/batch'.freeze
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 { |_event| _event.payload(api_key) }.join("\n")
29
+ events.flatten.map(&:payload).join("\n")
30
30
  end
31
31
  end
32
32
  end
@@ -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 and tid. Ensure you always pass cid and t when
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(tid)
19
- URI.encode_www_form(@params.merge({"tid": tid}))
18
+ def payload
19
+ URI.encode_www_form(@params)
20
20
  end
21
21
  end
22
22
  end
@@ -1,3 +1,3 @@
1
1
  module Gaevents
2
- VERSION = "1.0"
2
+ VERSION = "1.01"
3
3
  end
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.0'
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-22 00:00:00.000000000 Z
11
+ date: 2017-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler