Construct an instance of AlphaAnalyticsDataClient.
Parameters:
Name
Type
Attributes
Description
options
object
<optional>
The configuration object.
The options accepted by the constructor are described in detail
in this document.
The common options are:
Properties
Name
Type
Attributes
Description
credentials
object
<optional>
Credentials object.
Properties
Name
Type
Attributes
Description
client_email
string
<optional>
private_key
string
<optional>
email
string
<optional>
Account email address. Required when
using a .pem or .p12 keyFilename.
keyFilename
string
<optional>
Full path to the a .json, .pem, or
.p12 key downloaded from the Google Developers Console. If you provide
a path to a JSON file, the projectId option below is not necessary.
NOTE: .pem and .p12 require you to specify options.email as well.
port
number
<optional>
The port on which to connect to
the remote host.
projectId
string
<optional>
The project ID from the Google
Developer's Console, e.g. 'grape-spaceship-123'. We will also check
the environment variable GCLOUD_PROJECT for your project ID. If your
app is running in an environment which supports
Application Default Credentials,
your project ID will be detected automatically.
apiEndpoint
string
<optional>
The domain name of the
API remote host.
clientConfig
gax.ClientConfig
<optional>
Client configuration override.
Follows the structure of gapicConfig.
fallback
boolean
<optional>
Use HTTP fallback mode.
In fallback mode, a special browser-compatible transport implementation is used
instead of gRPC transport. In browser context (if the window object is defined)
the fallback mode is enabled automatically; set options.fallback to false
if you need to override this behavior.
Members
apiEndpoint
The DNS address for this API service - same as servicePath(),
exists for compatibility reasons.
port
The port for this API service.
scopes
The scopes needed to make gRPC calls for every method defined
in this service.
A property whose events are tracked. This entity must be specified for the
batch. The entity within RunPivotReportRequest may either be unspecified or
consistent with this entity.
requests
Array.<number>
Individual requests. Each request has a separate pivot report response.
Each batch request is allowed up to 5 requests.
The promise which resolves to an array.
The first element of the array is an object representing BatchRunPivotReportsResponse.
Please see the
documentation
for more details and examples.
A property whose events are tracked. This entity must be specified for the
batch. The entity within RunReportRequest may either be unspecified or
consistent with this entity.
requests
Array.<number>
Individual requests. Each request has a separate report response. Each
batch request is allowed up to 5 requests.
The promise which resolves to an array.
The first element of the array is an object representing BatchRunReportsResponse.
Please see the
documentation
for more details and examples.
The client will no longer be usable and all future behavior is undefined.
Returns:
Type
Description
Promise
A promise that resolves when the client is closed.
getMetadata(request, optionsopt) → {Promise}
Returns metadata for dimensions and metrics available in reporting methods.
Used to explore the dimensions and metrics. In this method, a Google
Analytics GA4 Property Identifier is specified in the request, and
the metadata response includes Custom dimensions and metrics as well as
Universal metadata.
For example if a custom metric with parameter name levels_unlocked is
registered to a property, the Metadata response will contain
customEvent:levels_unlocked. Universal metadata are dimensions and
metrics applicable to any property such as country and totalUsers.
Parameters:
Name
Type
Attributes
Description
request
Object
The request object that will be sent.
Properties
Name
Type
Description
name
string
Required. The resource name of the metadata to retrieve. This name field is
specified in the URL path and not URL parameters. Property is a numeric
Google Analytics GA4 Property identifier. To learn more, see where to find
your Property
ID.
Example: properties/1234/metadata
Set the Property ID to 0 for dimensions and metrics common to all
properties. In this special mode, this method will not return custom
dimensions and metrics.
The promise which resolves to an array.
The first element of the array is an object representing Metadata.
Please see the
documentation
for more details and examples.
A promise that resolves to string containing the project ID.
initialize() → {Promise}
Initialize the client.
Performs asynchronous operations (such as authentication) and prepares the client.
This function will be called automatically when any class method is called for the
first time, but if you need to initialize it before calling an actual method,
feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Returns:
Type
Description
Promise
A promise that resolves to an authenticated service stub.
A fully-qualified path representing Metadata resource.
Returns:
Type
Description
string
A string representing the property.
metadataPath(property) → {string}
Return a fully-qualified metadata resource name string.
Parameters:
Name
Type
Description
property
string
Returns:
Type
Description
string
Resource name string.
runPivotReport(request, optionsopt) → {Promise}
Returns a customized pivot report of your Google Analytics event data.
Pivot reports are more advanced and expressive formats than regular
reports. In a pivot report, dimensions are only visible if they are
included in a pivot. Multiple pivots can be specified to further dissect
your data.
A property whose events are tracked. Within a batch request, this entity
should either be unspecified or consistent with the batch-level entity.
dimensions
Array.<number>
The dimensions requested. All defined dimensions must be used by one of the
following: dimension_expression, dimension_filter, pivots, order_bys.
metrics
Array.<number>
The metrics requested, at least one metric needs to be specified. All
defined metrics must be used by one of the following: metric_expression,
metric_filter, order_bys.
The filter clause of metrics. Applied at post aggregation phase, similar to
SQL having-clause. Metrics must be requested to be used in this filter.
Dimensions cannot be used in this filter.
pivots
Array.<number>
Describes the visual format of the report's dimensions in columns or rows.
The union of the fieldNames (dimension names) in all pivots must be a
subset of dimension names defined in Dimensions. No two pivots can share a
dimension. A dimension is only visible if it appears in a pivot.
dateRanges
Array.<number>
The date range to retrieve event data for the report. If multiple date
ranges are specified, event data from each date range is used in the
report. A special dimension with field name "dateRange" can be included in
a Pivot's field names; if included, the report compares between date
ranges. In a cohort request, this dateRanges must be unspecified.
currencyCode
string
A currency code in ISO4217 format, such as "AED", "USD", "JPY".
If the field is empty, the report uses the entity's default currency.
Cohort group associated with this request. If there is a cohort group
in the request the 'cohort' dimension must be present.
keepEmptyRows
boolean
If false or unspecified, each row with all metrics equal to 0 will not be
returned. If true, these rows will be returned if they are not separately
removed by a filter.
returnPropertyQuota
boolean
Toggles whether to return the current state of this Analytics Property's
quota. Quota is returned in PropertyQuota.
The promise which resolves to an array.
The first element of the array is an object representing RunPivotReportResponse.
Please see the
documentation
for more details and examples.
The Google Analytics Realtime API returns a customized report of realtime
event data for your property. These reports show events and usage from the
last 30 minutes.
Parameters:
Name
Type
Attributes
Description
request
Object
The request object that will be sent.
Properties
Name
Type
Description
property
string
A Google Analytics GA4 property identifier whose events are tracked.
Specified in the URL path and not the body. To learn more, see where to
find your Property
ID.
Example: properties/1234
dimensions
Array.<number>
The dimensions requested and displayed.
metrics
Array.<number>
The metrics requested and displayed.
limit
number
The number of rows to return. If unspecified, 10 rows are returned. If
-1, all rows are returned.
The filter clause of metrics. Applied at post aggregation phase, similar to
SQL having-clause. Metrics must be requested to be used in this filter.
Dimensions cannot be used in this filter.
metricAggregations
Array.<number>
Aggregation of metrics. Aggregated metric values will be shown in rows
where the dimension_values are set to "RESERVED_(MetricAggregation)".
orderBys
Array.<number>
Specifies how rows are ordered in the response.
returnPropertyQuota
boolean
Toggles whether to return the current state of this Analytics Property's
Realtime quota. Quota is returned in PropertyQuota.
The promise which resolves to an array.
The first element of the array is an object representing RunRealtimeReportResponse.
Please see the
documentation
for more details and examples.
Returns a customized report of your Google Analytics event data. Reports
contain statistics derived from data collected by the Google Analytics
tracking code. The data returned from the API is as a table with columns
for the requested dimensions and metrics. Metrics are individual
measurements of user activity on your property, such as active users or
event count. Dimensions break down metrics across some common criteria,
such as country or event name.
A property whose events are tracked. Within a batch request, this entity
should either be unspecified or consistent with the batch-level entity.
dimensions
Array.<number>
The dimensions requested and displayed.
metrics
Array.<number>
The metrics requested and displayed.
dateRanges
Array.<number>
Date ranges of data to read. If multiple date ranges are requested, each
response row will contain a zero based date range index. If two date
ranges overlap, the event data for the overlapping days is included in the
response rows for both date ranges. In a cohort request, this dateRanges
must be unspecified.
offset
number
The row count of the start row. The first row is counted as row 0.
To learn more about this pagination parameter, see
Pagination.
limit
number
The number of rows to return. If unspecified, 10 rows are returned. If
-1, all rows are returned.
To learn more about this pagination parameter, see
Pagination.
metricAggregations
Array.<number>
Aggregation of metrics. Aggregated metric values will be shown in rows
where the dimension_values are set to "RESERVED_(MetricAggregation)".
The filter clause of metrics. Applied at post aggregation phase, similar to
SQL having-clause. Metrics must be requested to be used in this filter.
Dimensions cannot be used in this filter.
orderBys
Array.<number>
Specifies how rows are ordered in the response.
currencyCode
string
A currency code in ISO4217 format, such as "AED", "USD", "JPY".
If the field is empty, the report uses the entity's default currency.
Cohort group associated with this request. If there is a cohort group
in the request the 'cohort' dimension must be present.
keepEmptyRows
boolean
If false or unspecified, each row with all metrics equal to 0 will not be
returned. If true, these rows will be returned if they are not separately
removed by a filter.
returnPropertyQuota
boolean
Toggles whether to return the current state of this Analytics Property's
quota. Quota is returned in PropertyQuota.
The promise which resolves to an array.
The first element of the array is an object representing RunReportResponse.
Please see the
documentation
for more details and examples.