embulk-input-google_analytics 0.1.4 → 0.1.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f199cc26d3fdc13973dcc95596b26f900b579ddf
|
4
|
+
data.tar.gz: 740cf1a32904b1644eb7049c927ce511df950dc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc38e8e8e8521ed7aa92a9bf2e641662b841277ac3629f2f8c1dabbd2c87040b1b7fee5a9fd5c87333e06d4f19a548c7328e7d9d45670bccd0def96e9ed00ed6
|
7
|
+
data.tar.gz: 946942eb013dcdeb528711b5e1919e20847ba713f9a835840de03d8dbe2fd8a611874bec7b171a001aa4ee51cb2571853ac6a665c818aea3e6486706af708096
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 0.1.5 - 2016-08-23
|
2
|
+
* Enable custom dimensions [#10](https://github.com/treasure-data/embulk-input-google_analytics/pull/10)
|
3
|
+
|
1
4
|
## 0.1.4 - 2016-08-19
|
2
5
|
* Always add `view_id` into records [#9](https://github.com/treasure-data/embulk-input-google_analytics/pull/9)
|
3
6
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
spec.name = "embulk-input-google_analytics"
|
4
|
-
spec.version = "0.1.
|
4
|
+
spec.version = "0.1.5"
|
5
5
|
spec.authors = ["uu59"]
|
6
6
|
spec.summary = "Google Analytics input plugin for Embulk"
|
7
7
|
spec.description = "Loads records from Google Analytics."
|
@@ -122,6 +122,10 @@ module Embulk
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def get_columns_list
|
125
|
+
get_custom_dimensions + get_metadata_columns
|
126
|
+
end
|
127
|
+
|
128
|
+
def get_metadata_columns
|
125
129
|
# https://developers.google.com/analytics/devguides/reporting/metadata/v3/reference/metadata/columns/list
|
126
130
|
service = Google::Apis::AnalyticsV3::AnalyticsService.new
|
127
131
|
service.authorization = auth
|
@@ -130,6 +134,15 @@ module Embulk
|
|
130
134
|
end
|
131
135
|
end
|
132
136
|
|
137
|
+
def get_custom_dimensions
|
138
|
+
# https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/customDimensions/list
|
139
|
+
service = Google::Apis::AnalyticsV3::AnalyticsService.new
|
140
|
+
service.authorization = auth
|
141
|
+
retryer.with_retry do
|
142
|
+
service.list_custom_dimensions(get_profile[:account_id], get_profile[:web_property_id]).to_h[:items]
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
133
146
|
def build_report_request(page_token = nil)
|
134
147
|
query = {
|
135
148
|
view_id: view_id,
|
@@ -17,16 +17,22 @@ module Embulk
|
|
17
17
|
col_info = columns_list.find{|col| col[:id] == col_name}
|
18
18
|
raise ConfigError.new("Unknown metric/dimension '#{col_name}'") unless col_info
|
19
19
|
|
20
|
-
col_type =
|
21
|
-
|
22
|
-
|
20
|
+
col_type =
|
21
|
+
if col_info[:attributes]
|
22
|
+
# standard dimension
|
23
|
+
case col_info[:attributes][:dataType]
|
24
|
+
when "STRING"
|
25
|
+
:string
|
26
|
+
when "INTEGER"
|
27
|
+
:long
|
28
|
+
when "PERCENT", "FLOAT", "CURRENCY"
|
29
|
+
:double
|
30
|
+
when "TIME"
|
31
|
+
:timestamp
|
32
|
+
end
|
33
|
+
else
|
34
|
+
# custom dimension
|
23
35
|
:string
|
24
|
-
when "INTEGER"
|
25
|
-
:long
|
26
|
-
when "PERCENT", "FLOAT", "CURRENCY"
|
27
|
-
:double
|
28
|
-
when "TIME"
|
29
|
-
:timestamp
|
30
36
|
end
|
31
37
|
|
32
38
|
# time_series column should be timestamp
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-google_analytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- uu59
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|