ga_measurement_protocol 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/ga_measurement_protocol.rb +12 -2
- data/lib/ga_measurement_protocol/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fbcd857f2830aaf4be7d4b351c3f2f52fc5c29c
|
4
|
+
data.tar.gz: 314cb2cf9aff35aef7166119ce65e24f339e7122
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af63de2d0be4effbfcb844e11ed54cb47adba306dd31b9d68803979be98a2d8590aeefdf9e4b8e40c69d473d687aabf5ab35decba776d3fa24b9f2fe54af42c3
|
7
|
+
data.tar.gz: 0cb69f15daed60e9dede4957201ec19b307a3f68455adda5b99c19c4d894026841077c9800d94acda5438e0c8bbeaa7a9ed4c26a9c8a8ba17d85b691d9efec49
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# GaMeasurementProtocol
|
2
2
|
|
3
|
-
|
3
|
+
Api client for Google Analytics Measurement Protocol in Ruby
|
4
4
|
|
5
|
-
|
5
|
+
Measurement Protocol の概要 | アナリティクス Measurement Protocol | Google Developers
|
6
|
+
https://developers.google.com/analytics/devguides/collection/protocol/v1/?hl=ja
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -6,7 +6,8 @@ module GaMeasurementProtocol
|
|
6
6
|
# Your code goes here...
|
7
7
|
class Client
|
8
8
|
attr_reader :conn
|
9
|
-
def initialize
|
9
|
+
def initialize(debug: false)
|
10
|
+
@debug = debug
|
10
11
|
url =
|
11
12
|
'https://www.google-analytics.com'
|
12
13
|
|
@@ -18,7 +19,16 @@ module GaMeasurementProtocol
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def post(request)
|
21
|
-
|
22
|
+
url = if debug?
|
23
|
+
'/debug/collect'
|
24
|
+
else
|
25
|
+
'/collect'
|
26
|
+
end
|
27
|
+
JSON.parse(conn.post(url, request).body)
|
28
|
+
end
|
29
|
+
|
30
|
+
def debug?
|
31
|
+
@debug
|
22
32
|
end
|
23
33
|
end
|
24
34
|
end
|