@google-analytics/data 5.2.0 → 5.2.1
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.
- package/README.md +56 -123
- package/build/protos/protos.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
|
|
2
|
-
[//]: # "
|
|
2
|
+
[//]: # "The comments you see below are used to generate those parts of the template in later states."
|
|
3
3
|
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
|
|
4
4
|
|
|
5
|
-
# [Google Analytics Data:
|
|
6
|
-
|
|
7
|
-
[](https://cloud.google.com/terms/launch-stages)
|
|
8
|
-
[](https://www.npmjs.org/package/@google-analytics/data)
|
|
9
|
-
|
|
5
|
+
# [Google Analytics Data API: Nodejs Client][homepage]
|
|
10
6
|
|
|
7
|
+
This library is considered to be in **preview**. This means it is still a
|
|
8
|
+
work-in-progress and under active development. Any release is subject to
|
|
9
|
+
backwards-incompatible changes at any time.
|
|
11
10
|
|
|
11
|
+
[](https://www.npmjs.org/package/@google-cloud/data)
|
|
12
12
|
|
|
13
|
-
Data client for Node.js
|
|
13
|
+
Google Analytics Data API client for Node.js
|
|
14
14
|
|
|
15
|
+
[//]: # "partials.introduction"
|
|
15
16
|
|
|
16
17
|
A comprehensive list of changes in each version may be found in
|
|
17
|
-
[the CHANGELOG]
|
|
18
|
+
[the CHANGELOG][homepage_changelog].
|
|
19
|
+
|
|
20
|
+
* [Google Analytics Data API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/data/latest)
|
|
18
21
|
|
|
19
|
-
* [Google Analytics Data Node.js Client API Reference][client-docs]
|
|
20
|
-
* [Google Analytics Data Documentation][product-docs]
|
|
21
|
-
* [github.com/googleapis/google-cloud-node/packages/google-analytics-data](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-analytics-data)
|
|
22
22
|
|
|
23
23
|
Read more about the client libraries for Cloud APIs, including the older
|
|
24
24
|
Google APIs Client Libraries, in [Client Libraries Explained][explained].
|
|
@@ -27,119 +27,64 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
|
|
|
27
27
|
|
|
28
28
|
**Table of contents:**
|
|
29
29
|
|
|
30
|
-
|
|
31
30
|
* [Quickstart](#quickstart)
|
|
32
31
|
* [Before you begin](#before-you-begin)
|
|
33
32
|
* [Installing the client library](#installing-the-client-library)
|
|
34
|
-
|
|
35
|
-
* [Samples](#samples)
|
|
33
|
+
|
|
36
34
|
* [Versioning](#versioning)
|
|
37
35
|
* [Contributing](#contributing)
|
|
38
36
|
* [License](#license)
|
|
39
37
|
|
|
40
38
|
## Quickstart
|
|
41
|
-
|
|
42
39
|
### Before you begin
|
|
43
40
|
|
|
44
41
|
1. [Select or create a Cloud Platform project][projects].
|
|
45
|
-
1. [Enable
|
|
42
|
+
1. [Enable billing for your project][billing].
|
|
43
|
+
1. [Enable the Google Analytics Data API API][enable_api].
|
|
46
44
|
1. [Set up authentication][auth] so you can access the
|
|
47
45
|
API from your local workstation.
|
|
48
|
-
|
|
49
46
|
### Installing the client library
|
|
50
47
|
|
|
51
48
|
```bash
|
|
52
|
-
npm install @google-
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
### Using the client library
|
|
57
|
-
|
|
58
|
-
```javascript
|
|
59
|
-
/**
|
|
60
|
-
* TODO(developer): Uncomment this variable and replace with your
|
|
61
|
-
* Google Analytics 4 property ID before running the sample.
|
|
62
|
-
*/
|
|
63
|
-
// propertyId = 'YOUR-GA4-PROPERTY-ID';
|
|
64
|
-
|
|
65
|
-
// Imports the Google Analytics Data API client library.
|
|
66
|
-
const {BetaAnalyticsDataClient} = require('@google-analytics/data');
|
|
67
|
-
|
|
68
|
-
// Using a default constructor instructs the client to use the credentials
|
|
69
|
-
// specified in GOOGLE_APPLICATION_CREDENTIALS environment variable.
|
|
70
|
-
const analyticsDataClient = new BetaAnalyticsDataClient();
|
|
71
|
-
|
|
72
|
-
// Runs a simple report.
|
|
73
|
-
async function runReport() {
|
|
74
|
-
const [response] = await analyticsDataClient.runReport({
|
|
75
|
-
property: `properties/${propertyId}`,
|
|
76
|
-
dateRanges: [
|
|
77
|
-
{
|
|
78
|
-
startDate: '2020-03-31',
|
|
79
|
-
endDate: 'today',
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
dimensions: [
|
|
83
|
-
{
|
|
84
|
-
name: 'city',
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
metrics: [
|
|
88
|
-
{
|
|
89
|
-
name: 'activeUsers',
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
console.log('Report result:');
|
|
95
|
-
response.rows.forEach(row => {
|
|
96
|
-
console.log(row.dimensionValues[0], row.metricValues[0]);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
runReport();
|
|
101
|
-
|
|
49
|
+
npm install @google-cloud/data
|
|
102
50
|
```
|
|
103
51
|
|
|
104
|
-
|
|
52
|
+
[//]: # "partials.body"
|
|
105
53
|
|
|
106
54
|
## Samples
|
|
107
55
|
|
|
108
|
-
Samples are in the [`samples/`]
|
|
109
|
-
|
|
110
|
-
| Sample | Source Code |
|
|
111
|
-
| --------------------------- | --------------------------------- |
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
|
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
|
|
|
129
|
-
|
|
|
130
|
-
|
|
|
131
|
-
|
|
|
132
|
-
|
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
|
|
|
136
|
-
|
|
|
137
|
-
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
The [Google Analytics Data Node.js Client API Reference][client-docs] documentation
|
|
142
|
-
also contains samples.
|
|
56
|
+
Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample.
|
|
57
|
+
|
|
58
|
+
| Sample | Source Code |
|
|
59
|
+
| --------------------------- | --------------------------------- |
|
|
60
|
+
| create audience list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_audience_list.js) |
|
|
61
|
+
| create recurring audience list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_recurring_audience_list.js) |
|
|
62
|
+
| create report task | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_report_task.js) |
|
|
63
|
+
| get audience list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_audience_list.js) |
|
|
64
|
+
| get property quotas snapshot | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_property_quotas_snapshot.js) |
|
|
65
|
+
| get recurring audience list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_recurring_audience_list.js) |
|
|
66
|
+
| get report task | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_report_task.js) |
|
|
67
|
+
| list audience lists | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_audience_lists.js) |
|
|
68
|
+
| list recurring audience lists | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_recurring_audience_lists.js) |
|
|
69
|
+
| list report tasks | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_report_tasks.js) |
|
|
70
|
+
| query audience list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.query_audience_list.js) |
|
|
71
|
+
| query report task | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.query_report_task.js) |
|
|
72
|
+
| run funnel report | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.run_funnel_report.js) |
|
|
73
|
+
| sheet export audience list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.sheet_export_audience_list.js) |
|
|
74
|
+
| analytics | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/snippet_metadata_google.analytics.data.v1alpha.json) |
|
|
75
|
+
| batch run pivot reports | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1beta/beta_analytics_data.batch_run_pivot_reports.js) |
|
|
76
|
+
| batch run reports | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1beta/beta_analytics_data.batch_run_reports.js) |
|
|
77
|
+
| check compatibility | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1beta/beta_analytics_data.check_compatibility.js) |
|
|
78
|
+
| create audience export | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1beta/beta_analytics_data.create_audience_export.js) |
|
|
79
|
+
| get audience export | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1beta/beta_analytics_data.get_audience_export.js) |
|
|
80
|
+
| get metadata | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1beta/beta_analytics_data.get_metadata.js) |
|
|
81
|
+
| list audience exports | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1beta/beta_analytics_data.list_audience_exports.js) |
|
|
82
|
+
| query audience export | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1beta/beta_analytics_data.query_audience_export.js) |
|
|
83
|
+
| run pivot report | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1beta/beta_analytics_data.run_pivot_report.js) |
|
|
84
|
+
| run realtime report | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1beta/beta_analytics_data.run_realtime_report.js) |
|
|
85
|
+
| run report | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1beta/beta_analytics_data.run_report.js) |
|
|
86
|
+
| analytics | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1beta/snippet_metadata_google.analytics.data.v1beta.json) |
|
|
87
|
+
|
|
143
88
|
|
|
144
89
|
## Supported Node.js Versions
|
|
145
90
|
|
|
@@ -159,48 +104,36 @@ best-efforts basis with the following warnings:
|
|
|
159
104
|
Client libraries targeting some end-of-life versions of Node.js are available, and
|
|
160
105
|
can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
|
|
161
106
|
The dist-tags follow the naming convention `legacy-(version)`.
|
|
162
|
-
For example, `npm install @google-
|
|
107
|
+
For example, `npm install @google-cloud/data@legacy-8` installs client libraries
|
|
163
108
|
for versions compatible with Node.js 8.
|
|
164
109
|
|
|
165
110
|
## Versioning
|
|
166
111
|
|
|
167
112
|
This library follows [Semantic Versioning](http://semver.org/).
|
|
168
113
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
This library is considered to be in **preview**. This means it is still a
|
|
176
|
-
work-in-progress and under active development. Any release is subject to
|
|
177
|
-
backwards-incompatible changes at any time.
|
|
178
|
-
|
|
179
|
-
|
|
180
114
|
More Information: [Google Cloud Platform Launch Stages][launch_stages]
|
|
181
115
|
|
|
182
116
|
[launch_stages]: https://cloud.google.com/terms/launch-stages
|
|
183
117
|
|
|
184
118
|
## Contributing
|
|
185
119
|
|
|
186
|
-
Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md).
|
|
120
|
+
Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/CONTRIBUTING.md).
|
|
187
121
|
|
|
188
|
-
Please note that this `README.md
|
|
122
|
+
Please note that this `README.md`
|
|
189
123
|
and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
|
|
190
|
-
are generated from a central template.
|
|
191
|
-
to its templates in
|
|
192
|
-
[directory](https://github.com/googleapis/synthtool).
|
|
124
|
+
are generated from a central template.
|
|
193
125
|
|
|
194
126
|
## License
|
|
195
127
|
|
|
196
128
|
Apache Version 2.0
|
|
197
129
|
|
|
198
|
-
See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE)
|
|
130
|
+
See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/LICENSE)
|
|
199
131
|
|
|
200
|
-
[client-docs]: https://googleapis.dev/nodejs/analytics-data/latest/index.html
|
|
201
|
-
[product-docs]: https://developers.google.com/analytics/trusted-testing/analytics-data
|
|
202
132
|
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
|
|
203
133
|
[projects]: https://console.cloud.google.com/project
|
|
204
134
|
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
|
|
205
135
|
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=analyticsdata.googleapis.com
|
|
206
136
|
[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local
|
|
137
|
+
[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples
|
|
138
|
+
[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/CHANGELOG.md
|
|
139
|
+
[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data
|
package/build/protos/protos.js
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
|
29
29
|
|
|
30
30
|
// Exported root namespace
|
|
31
|
-
var $root = $protobuf.roots.
|
|
31
|
+
var $root = $protobuf.roots._google_cloud_data_protos || ($protobuf.roots._google_cloud_data_protos = {});
|
|
32
32
|
|
|
33
33
|
$root.google = (function() {
|
|
34
34
|
|