Google Analytics reporting data service. v1beta
Package
@google-analytics/dataConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
Construct an instance of BetaAnalyticsDataClient.
Parameters | |
---|---|
Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
get apiEndpoint(): string;
The DNS address for this API service.
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath.
auth
auth: gax.GoogleAuth;
betaAnalyticsDataStub
betaAnalyticsDataStub?: Promise<{
[name: string]: Function;
}>;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
operationsClient
operationsClient: gax.OperationsClient;
pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};
port
static get port(): number;
The port for this API service.
scopes
static get scopes(): string[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;
The DNS address for this API service.
universeDomain
get universeDomain(): string;
warn
warn: (code: string, message: string, warnType?: string) => void;
Methods
audienceExportPath(property, audienceExport)
audienceExportPath(property: string, audienceExport: string): string;
Return a fully-qualified audienceExport resource name string.
Parameters | |
---|---|
Name | Description |
property |
string
|
audienceExport |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
batchRunPivotReports(request, options)
batchRunPivotReports(request?: protos.google.analytics.data.v1beta.IBatchRunPivotReportsRequest, options?: CallOptions): Promise<[
protos.google.analytics.data.v1beta.IBatchRunPivotReportsResponse,
(protos.google.analytics.data.v1beta.IBatchRunPivotReportsRequest | undefined),
{} | undefined
]>;
Returns multiple pivot reports in a batch. All reports must be for the same GA4 Property.
Parameters | |
---|---|
Name | Description |
request |
IBatchRunPivotReportsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.analytics.data.v1beta.IBatchRunPivotReportsResponse,
(protos.google.analytics.data.v1beta.IBatchRunPivotReportsRequest | undefined),
{} | undefined
]> |
{Promise} - 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. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* 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 (https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
* This property must be specified for the batch. The property within
* RunPivotReportRequest may either be unspecified or consistent with this
* property.
* Example: properties/1234
*/
// const property = 'abc123'
/**
* Individual requests. Each request has a separate pivot report response.
* Each batch request is allowed up to 5 requests.
*/
// const requests = [1,2,3,4]
// Imports the Data library
const {BetaAnalyticsDataClient} = require('@google-analytics/data').v1beta;
// Instantiates a client
const dataClient = new BetaAnalyticsDataClient();
async function callBatchRunPivotReports() {
// Construct request
const request = {
};
// Run request
const response = await dataClient.batchRunPivotReports(request);
console.log(response);
}
callBatchRunPivotReports();
batchRunPivotReports(request, options, callback)
batchRunPivotReports(request: protos.google.analytics.data.v1beta.IBatchRunPivotReportsRequest, options: CallOptions, callback: Callback<protos.google.analytics.data.v1beta.IBatchRunPivotReportsResponse, protos.google.analytics.data.v1beta.IBatchRunPivotReportsRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IBatchRunPivotReportsRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.analytics.data.v1beta.IBatchRunPivotReportsResponse, protos.google.analytics.data.v1beta.IBatchRunPivotReportsRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
batchRunPivotReports(request, callback)
batchRunPivotReports(request: protos.google.analytics.data.v1beta.IBatchRunPivotReportsRequest, callback: Callback<protos.google.analytics.data.v1beta.IBatchRunPivotReportsResponse, protos.google.analytics.data.v1beta.IBatchRunPivotReportsRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IBatchRunPivotReportsRequest
|
callback |
Callback<protos.google.analytics.data.v1beta.IBatchRunPivotReportsResponse, protos.google.analytics.data.v1beta.IBatchRunPivotReportsRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
batchRunReports(request, options)
batchRunReports(request?: protos.google.analytics.data.v1beta.IBatchRunReportsRequest, options?: CallOptions): Promise<[
protos.google.analytics.data.v1beta.IBatchRunReportsResponse,
protos.google.analytics.data.v1beta.IBatchRunReportsRequest | undefined,
{} | undefined
]>;
Returns multiple reports in a batch. All reports must be for the same GA4 Property.
Parameters | |
---|---|
Name | Description |
request |
IBatchRunReportsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.analytics.data.v1beta.IBatchRunReportsResponse,
protos.google.analytics.data.v1beta.IBatchRunReportsRequest | undefined,
{} | undefined
]> |
{Promise} - 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. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* 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 (https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
* This property must be specified for the batch. The property within
* RunReportRequest may either be unspecified or consistent with this
* property.
* Example: properties/1234
*/
// const property = 'abc123'
/**
* Individual requests. Each request has a separate report response. Each
* batch request is allowed up to 5 requests.
*/
// const requests = [1,2,3,4]
// Imports the Data library
const {BetaAnalyticsDataClient} = require('@google-analytics/data').v1beta;
// Instantiates a client
const dataClient = new BetaAnalyticsDataClient();
async function callBatchRunReports() {
// Construct request
const request = {
};
// Run request
const response = await dataClient.batchRunReports(request);
console.log(response);
}
callBatchRunReports();
batchRunReports(request, options, callback)
batchRunReports(request: protos.google.analytics.data.v1beta.IBatchRunReportsRequest, options: CallOptions, callback: Callback<protos.google.analytics.data.v1beta.IBatchRunReportsResponse, protos.google.analytics.data.v1beta.IBatchRunReportsRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IBatchRunReportsRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.analytics.data.v1beta.IBatchRunReportsResponse, protos.google.analytics.data.v1beta.IBatchRunReportsRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
batchRunReports(request, callback)
batchRunReports(request: protos.google.analytics.data.v1beta.IBatchRunReportsRequest, callback: Callback<protos.google.analytics.data.v1beta.IBatchRunReportsResponse, protos.google.analytics.data.v1beta.IBatchRunReportsRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IBatchRunReportsRequest
|
callback |
Callback<protos.google.analytics.data.v1beta.IBatchRunReportsResponse, protos.google.analytics.data.v1beta.IBatchRunReportsRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
cancelOperation(request, options, callback)
cancelOperation(request: protos.google.longrunning.CancelOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;
Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED
.
Parameters | |
---|---|
Name | Description |
request |
CancelOperationRequest
The request object that will be sent. |
options |
CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
callback |
Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>
The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call. |
Returns | |
---|---|
Type | Description |
Promise<protos.google.protobuf.Empty> |
const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});
checkCompatibility(request, options)
checkCompatibility(request?: protos.google.analytics.data.v1beta.ICheckCompatibilityRequest, options?: CallOptions): Promise<[
protos.google.analytics.data.v1beta.ICheckCompatibilityResponse,
(protos.google.analytics.data.v1beta.ICheckCompatibilityRequest | undefined),
{} | undefined
]>;
This compatibility method lists dimensions and metrics that can be added to a report request and maintain compatibility. This method fails if the request's dimensions and metrics are incompatible.
In Google Analytics, reports fail if they request incompatible dimensions and/or metrics; in that case, you will need to remove dimensions and/or metrics from the incompatible report until the report is compatible.
The Realtime and Core reports have different compatibility rules. This method checks compatibility for Core reports.
Parameters | |
---|---|
Name | Description |
request |
ICheckCompatibilityRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.analytics.data.v1beta.ICheckCompatibilityResponse,
(protos.google.analytics.data.v1beta.ICheckCompatibilityRequest | undefined),
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing CheckCompatibilityResponse. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* A Google Analytics GA4 property identifier whose events are tracked. To
* learn more, see where to find your Property
* ID (https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
* `property` should be the same value as in your `runReport` request.
* Example: properties/1234
*/
// const property = 'abc123'
/**
* The dimensions in this report. `dimensions` should be the same value as in
* your `runReport` request.
*/
// const dimensions = [1,2,3,4]
/**
* The metrics in this report. `metrics` should be the same value as in your
* `runReport` request.
*/
// const metrics = [1,2,3,4]
/**
* The filter clause of dimensions. `dimensionFilter` should be the same value
* as in your `runReport` request.
*/
// const dimensionFilter = {}
/**
* The filter clause of metrics. `metricFilter` should be the same value as in
* your `runReport` request
*/
// const metricFilter = {}
/**
* Filters the dimensions and metrics in the response to just this
* compatibility. Commonly used as `”compatibilityFilter”: “COMPATIBLE”`
* to only return compatible dimensions & metrics.
*/
// const compatibilityFilter = {}
// Imports the Data library
const {BetaAnalyticsDataClient} = require('@google-analytics/data').v1beta;
// Instantiates a client
const dataClient = new BetaAnalyticsDataClient();
async function callCheckCompatibility() {
// Construct request
const request = {
};
// Run request
const response = await dataClient.checkCompatibility(request);
console.log(response);
}
callCheckCompatibility();
checkCompatibility(request, options, callback)
checkCompatibility(request: protos.google.analytics.data.v1beta.ICheckCompatibilityRequest, options: CallOptions, callback: Callback<protos.google.analytics.data.v1beta.ICheckCompatibilityResponse, protos.google.analytics.data.v1beta.ICheckCompatibilityRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICheckCompatibilityRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.analytics.data.v1beta.ICheckCompatibilityResponse, protos.google.analytics.data.v1beta.ICheckCompatibilityRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
checkCompatibility(request, callback)
checkCompatibility(request: protos.google.analytics.data.v1beta.ICheckCompatibilityRequest, callback: Callback<protos.google.analytics.data.v1beta.ICheckCompatibilityResponse, protos.google.analytics.data.v1beta.ICheckCompatibilityRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICheckCompatibilityRequest
|
callback |
Callback<protos.google.analytics.data.v1beta.ICheckCompatibilityResponse, protos.google.analytics.data.v1beta.ICheckCompatibilityRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
checkCreateAudienceExportProgress(name)
checkCreateAudienceExportProgress(name: string): Promise<LROperation<protos.google.analytics.data.v1beta.AudienceExport, protos.google.analytics.data.v1beta.AudienceExportMetadata>>;
Check the status of the long running operation returned by createAudienceExport()
.
Parameter | |
---|---|
Name | Description |
name |
string
The operation name that will be passed. |
Returns | |
---|---|
Type | Description |
Promise<LROperation<protos.google.analytics.data.v1beta.AudienceExport, protos.google.analytics.data.v1beta.AudienceExportMetadata>> |
{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The parent resource where this audience export will be created.
* Format: `properties/{property}`
*/
// const parent = 'abc123'
/**
* Required. The audience export to create.
*/
// const audienceExport = {}
// Imports the Data library
const {BetaAnalyticsDataClient} = require('@google-analytics/data').v1beta;
// Instantiates a client
const dataClient = new BetaAnalyticsDataClient();
async function callCreateAudienceExport() {
// Construct request
const request = {
parent,
audienceExport,
};
// Run request
const [operation] = await dataClient.createAudienceExport(request);
const [response] = await operation.promise();
console.log(response);
}
callCreateAudienceExport();
close()
close(): Promise<void>;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Returns | |
---|---|
Type | Description |
Promise<void> |
{Promise} A promise that resolves when the client is closed. |
createAudienceExport(request, options)
createAudienceExport(request?: protos.google.analytics.data.v1beta.ICreateAudienceExportRequest, options?: CallOptions): Promise<[
LROperation<protos.google.analytics.data.v1beta.IAudienceExport, protos.google.analytics.data.v1beta.IAudienceExportMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]>;
Creates an audience export for later retrieval. This method quickly returns the audience export's resource name and initiates a long running asynchronous request to form an audience export. To export the users in an audience export, first create the audience export through this method and then send the audience resource name to the QueryAudienceExport
method.
See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics) for an introduction to Audience Exports with examples.
An audience export is a snapshot of the users currently in the audience at the time of audience export creation. Creating audience exports for one audience on different days will return different results as users enter and exit the audience.
Audiences in Google Analytics 4 allow you to segment your users in the ways that are important to your business. To learn more, see https://support.google.com/analytics/answer/9267572. Audience exports contain the users in each audience.
Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
Parameters | |
---|---|
Name | Description |
request |
ICreateAudienceExportRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
LROperation<protos.google.analytics.data.v1beta.IAudienceExport, protos.google.analytics.data.v1beta.IAudienceExportMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The parent resource where this audience export will be created.
* Format: `properties/{property}`
*/
// const parent = 'abc123'
/**
* Required. The audience export to create.
*/
// const audienceExport = {}
// Imports the Data library
const {BetaAnalyticsDataClient} = require('@google-analytics/data').v1beta;
// Instantiates a client
const dataClient = new BetaAnalyticsDataClient();
async function callCreateAudienceExport() {
// Construct request
const request = {
parent,
audienceExport,
};
// Run request
const [operation] = await dataClient.createAudienceExport(request);
const [response] = await operation.promise();
console.log(response);
}
callCreateAudienceExport();
createAudienceExport(request, options, callback)
createAudienceExport(request: protos.google.analytics.data.v1beta.ICreateAudienceExportRequest, options: CallOptions, callback: Callback<LROperation<protos.google.analytics.data.v1beta.IAudienceExport, protos.google.analytics.data.v1beta.IAudienceExportMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateAudienceExportRequest
|
options |
CallOptions
|
callback |
Callback<LROperation<protos.google.analytics.data.v1beta.IAudienceExport, protos.google.analytics.data.v1beta.IAudienceExportMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createAudienceExport(request, callback)
createAudienceExport(request: protos.google.analytics.data.v1beta.ICreateAudienceExportRequest, callback: Callback<LROperation<protos.google.analytics.data.v1beta.IAudienceExport, protos.google.analytics.data.v1beta.IAudienceExportMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateAudienceExportRequest
|
callback |
Callback<LROperation<protos.google.analytics.data.v1beta.IAudienceExport, protos.google.analytics.data.v1beta.IAudienceExportMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteOperation(request, options, callback)
deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;
Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
.
Parameters | |
---|---|
Name | Description |
request |
DeleteOperationRequest
The request object that will be sent. |
options |
CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
callback |
Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>
The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call. |
Returns | |
---|---|
Type | Description |
Promise<protos.google.protobuf.Empty> |
const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});
getAudienceExport(request, options)
getAudienceExport(request?: protos.google.analytics.data.v1beta.IGetAudienceExportRequest, options?: CallOptions): Promise<[
protos.google.analytics.data.v1beta.IAudienceExport,
protos.google.analytics.data.v1beta.IGetAudienceExportRequest | undefined,
{} | undefined
]>;
Gets configuration metadata about a specific audience export. This method can be used to understand an audience export after it has been created.
See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics) for an introduction to Audience Exports with examples.
Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
Parameters | |
---|---|
Name | Description |
request |
IGetAudienceExportRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.analytics.data.v1beta.IAudienceExport,
protos.google.analytics.data.v1beta.IGetAudienceExportRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The audience export resource name.
* Format: `properties/{property}/audienceExports/{audience_export}`
*/
// const name = 'abc123'
// Imports the Data library
const {BetaAnalyticsDataClient} = require('@google-analytics/data').v1beta;
// Instantiates a client
const dataClient = new BetaAnalyticsDataClient();
async function callGetAudienceExport() {
// Construct request
const request = {
name,
};
// Run request
const response = await dataClient.getAudienceExport(request);
console.log(response);
}
callGetAudienceExport();
getAudienceExport(request, options, callback)
getAudienceExport(request: protos.google.analytics.data.v1beta.IGetAudienceExportRequest, options: CallOptions, callback: Callback<protos.google.analytics.data.v1beta.IAudienceExport, protos.google.analytics.data.v1beta.IGetAudienceExportRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetAudienceExportRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.analytics.data.v1beta.IAudienceExport, protos.google.analytics.data.v1beta.IGetAudienceExportRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getAudienceExport(request, callback)
getAudienceExport(request: protos.google.analytics.data.v1beta.IGetAudienceExportRequest, callback: Callback<protos.google.analytics.data.v1beta.IAudienceExport, protos.google.analytics.data.v1beta.IGetAudienceExportRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetAudienceExportRequest
|
callback |
Callback<protos.google.analytics.data.v1beta.IAudienceExport, protos.google.analytics.data.v1beta.IGetAudienceExportRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getMetadata(request, options)
getMetadata(request?: protos.google.analytics.data.v1beta.IGetMetadataRequest, options?: CallOptions): Promise<[
protos.google.analytics.data.v1beta.IMetadata,
protos.google.analytics.data.v1beta.IGetMetadataRequest | undefined,
{} | undefined
]>;
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 | Description |
request |
IGetMetadataRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.analytics.data.v1beta.IMetadata,
protos.google.analytics.data.v1beta.IGetMetadataRequest | undefined,
{} | undefined
]> |
{Promise} - 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. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* 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 (https://developers.google.com/analytics/devguides/reporting/data/v1/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.
*/
// const name = 'abc123'
// Imports the Data library
const {BetaAnalyticsDataClient} = require('@google-analytics/data').v1beta;
// Instantiates a client
const dataClient = new BetaAnalyticsDataClient();
async function callGetMetadata() {
// Construct request
const request = {
name,
};
// Run request
const response = await dataClient.getMetadata(request);
console.log(response);
}
callGetMetadata();
getMetadata(request, options, callback)
getMetadata(request: protos.google.analytics.data.v1beta.IGetMetadataRequest, options: CallOptions, callback: Callback<protos.google.analytics.data.v1beta.IMetadata, protos.google.analytics.data.v1beta.IGetMetadataRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetMetadataRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.analytics.data.v1beta.IMetadata, protos.google.analytics.data.v1beta.IGetMetadataRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getMetadata(request, callback)
getMetadata(request: protos.google.analytics.data.v1beta.IGetMetadataRequest, callback: Callback<protos.google.analytics.data.v1beta.IMetadata, protos.google.analytics.data.v1beta.IGetMetadataRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetMetadataRequest
|
callback |
Callback<protos.google.analytics.data.v1beta.IMetadata, protos.google.analytics.data.v1beta.IGetMetadataRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getOperation(request, options, callback)
getOperation(request: protos.google.longrunning.GetOperationRequest, options?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;
Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
Parameters | |
---|---|
Name | Description |
request |
GetOperationRequest
The request object that will be sent. |
options |
CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
callback |
Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>
The function which will be called with the result of the API call. The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call. |
Returns | |
---|---|
Type | Description |
Promise<[protos.google.longrunning.Operation]> |
const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)
getProjectId()
getProjectId(): Promise<string>;
Returns | |
---|---|
Type | Description |
Promise<string> |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter | |
---|---|
Name | Description |
callback |
Callback<string, undefined, undefined>
|
Returns | |
---|---|
Type | Description |
void |
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;
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<{
[name: string]: Function;
}> |
{Promise} A promise that resolves to an authenticated service stub. |
listAudienceExports(request, options)
listAudienceExports(request?: protos.google.analytics.data.v1beta.IListAudienceExportsRequest, options?: CallOptions): Promise<[
protos.google.analytics.data.v1beta.IAudienceExport[],
protos.google.analytics.data.v1beta.IListAudienceExportsRequest | null,
protos.google.analytics.data.v1beta.IListAudienceExportsResponse
]>;
Lists all audience exports for a property. This method can be used for you to find and reuse existing audience exports rather than creating unnecessary new audience exports. The same audience can have multiple audience exports that represent the export of users that were in an audience on different days.
See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics) for an introduction to Audience Exports with examples.
Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
Parameters | |
---|---|
Name | Description |
request |
IListAudienceExportsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.analytics.data.v1beta.IAudienceExport[],
protos.google.analytics.data.v1beta.IListAudienceExportsRequest | null,
protos.google.analytics.data.v1beta.IListAudienceExportsResponse
]> |
{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using |
listAudienceExports(request, options, callback)
listAudienceExports(request: protos.google.analytics.data.v1beta.IListAudienceExportsRequest, options: CallOptions, callback: PaginationCallback<protos.google.analytics.data.v1beta.IListAudienceExportsRequest, protos.google.analytics.data.v1beta.IListAudienceExportsResponse | null | undefined, protos.google.analytics.data.v1beta.IAudienceExport>): void;
Parameters | |
---|---|
Name | Description |
request |
IListAudienceExportsRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.analytics.data.v1beta.IListAudienceExportsRequest, protos.google.analytics.data.v1beta.IListAudienceExportsResponse | null | undefined, protos.google.analytics.data.v1beta.IAudienceExport>
|
Returns | |
---|---|
Type | Description |
void |
listAudienceExports(request, callback)
listAudienceExports(request: protos.google.analytics.data.v1beta.IListAudienceExportsRequest, callback: PaginationCallback<protos.google.analytics.data.v1beta.IListAudienceExportsRequest, protos.google.analytics.data.v1beta.IListAudienceExportsResponse | null | undefined, protos.google.analytics.data.v1beta.IAudienceExport>): void;
Parameters | |
---|---|
Name | Description |
request |
IListAudienceExportsRequest
|
callback |
PaginationCallback<protos.google.analytics.data.v1beta.IListAudienceExportsRequest, protos.google.analytics.data.v1beta.IListAudienceExportsResponse | null | undefined, protos.google.analytics.data.v1beta.IAudienceExport>
|
Returns | |
---|---|
Type | Description |
void |
listAudienceExportsAsync(request, options)
listAudienceExportsAsync(request?: protos.google.analytics.data.v1beta.IListAudienceExportsRequest, options?: CallOptions): AsyncIterable<protos.google.analytics.data.v1beta.IAudienceExport>;
Equivalent to listAudienceExports
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters | |
---|---|
Name | Description |
request |
IListAudienceExportsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<protos.google.analytics.data.v1beta.IAudienceExport> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. All audience exports for this property will be listed in the
* response. Format: `properties/{property}`
*/
// const parent = 'abc123'
/**
* Optional. The maximum number of audience exports to return. The service may
* return fewer than this value. If unspecified, at most 200 audience exports
* will be returned. The maximum value is 1000 (higher values will be coerced
* to the maximum).
*/
// const pageSize = 1234
/**
* Optional. A page token, received from a previous `ListAudienceExports`
* call. Provide this to retrieve the subsequent page.
* When paginating, all other parameters provided to `ListAudienceExports`
* must match the call that provided the page token.
*/
// const pageToken = 'abc123'
// Imports the Data library
const {BetaAnalyticsDataClient} = require('@google-analytics/data').v1beta;
// Instantiates a client
const dataClient = new BetaAnalyticsDataClient();
async function callListAudienceExports() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = dataClient.listAudienceExportsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListAudienceExports();
listAudienceExportsStream(request, options)
listAudienceExportsStream(request?: protos.google.analytics.data.v1beta.IListAudienceExportsRequest, options?: CallOptions): Transform;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters | |
---|---|
Name | Description |
request |
IListAudienceExportsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Transform |
{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using |
listOperationsAsync(request, options)
listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;
Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED
. Returns an iterable object.
For-await-of syntax is used with the iterable to recursively get response element on-demand.
Parameters | |
---|---|
Name | Description |
request |
ListOperationsRequest
The request object that will be sent. |
options |
CallOptions
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<protos.google.longrunning.ListOperationsResponse> |
{Object} An iterable Object that conforms to iteration protocols. |
const client = longrunning.operationsClient();
for await (const response of client.listOperationsAsync(request));
// doThingsWith(response)
matchAudienceExportFromAudienceExportName(audienceExportName)
matchAudienceExportFromAudienceExportName(audienceExportName: string): string | number;
Parse the audience_export from AudienceExport resource.
Parameter | |
---|---|
Name | Description |
audienceExportName |
string
A fully-qualified path representing AudienceExport resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the audience_export. |
matchPropertyFromAudienceExportName(audienceExportName)
matchPropertyFromAudienceExportName(audienceExportName: string): string | number;
Parse the property from AudienceExport resource.
Parameter | |
---|---|
Name | Description |
audienceExportName |
string
A fully-qualified path representing AudienceExport resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the property. |
matchPropertyFromMetadataName(metadataName)
matchPropertyFromMetadataName(metadataName: string): string | number;
Parse the property from Metadata resource.
Parameter | |
---|---|
Name | Description |
metadataName |
string
A fully-qualified path representing Metadata resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the property. |
matchPropertyFromPropertyName(propertyName)
matchPropertyFromPropertyName(propertyName: string): string | number;
Parse the property from Property resource.
Parameter | |
---|---|
Name | Description |
propertyName |
string
A fully-qualified path representing Property resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the property. |
metadataPath(property)
metadataPath(property: string): string;
Return a fully-qualified metadata resource name string.
Parameter | |
---|---|
Name | Description |
property |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
propertyPath(property)
propertyPath(property: string): string;
Return a fully-qualified property resource name string.
Parameter | |
---|---|
Name | Description |
property |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
queryAudienceExport(request, options)
queryAudienceExport(request?: protos.google.analytics.data.v1beta.IQueryAudienceExportRequest, options?: CallOptions): Promise<[
protos.google.analytics.data.v1beta.IQueryAudienceExportResponse,
(protos.google.analytics.data.v1beta.IQueryAudienceExportRequest | undefined),
{} | undefined
]>;
Retrieves an audience export of users. After creating an audience, the users are not immediately available for exporting. First, a request to CreateAudienceExport
is necessary to create an audience export of users, and then second, this method is used to retrieve the users in the audience export.
See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics) for an introduction to Audience Exports with examples.
Audiences in Google Analytics 4 allow you to segment your users in the ways that are important to your business. To learn more, see https://support.google.com/analytics/answer/9267572.
Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
Parameters | |
---|---|
Name | Description |
request |
IQueryAudienceExportRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.analytics.data.v1beta.IQueryAudienceExportResponse,
(protos.google.analytics.data.v1beta.IQueryAudienceExportRequest | undefined),
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing QueryAudienceExportResponse. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the audience export to retrieve users from.
* Format: `properties/{property}/audienceExports/{audience_export}`
*/
// const name = 'abc123'
/**
* Optional. The row count of the start row. The first row is counted as row
* 0.
* When paging, the first request does not specify offset; or equivalently,
* sets offset to 0; the first request returns the first `limit` of rows. The
* second request sets offset to the `limit` of the first request; the second
* request returns the second `limit` of rows.
* To learn more about this pagination parameter, see
* Pagination (https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
*/
// const offset = 1234
/**
* Optional. The number of rows to return. If unspecified, 10,000 rows are
* returned. The API returns a maximum of 250,000 rows per request, no matter
* how many you ask for. `limit` must be positive.
* The API can also return fewer rows than the requested `limit`, if there
* aren't as many dimension values as the `limit`.
* To learn more about this pagination parameter, see
* Pagination (https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
*/
// const limit = 1234
// Imports the Data library
const {BetaAnalyticsDataClient} = require('@google-analytics/data').v1beta;
// Instantiates a client
const dataClient = new BetaAnalyticsDataClient();
async function callQueryAudienceExport() {
// Construct request
const request = {
name,
};
// Run request
const response = await dataClient.queryAudienceExport(request);
console.log(response);
}
callQueryAudienceExport();
queryAudienceExport(request, options, callback)
queryAudienceExport(request: protos.google.analytics.data.v1beta.IQueryAudienceExportRequest, options: CallOptions, callback: Callback<protos.google.analytics.data.v1beta.IQueryAudienceExportResponse, protos.google.analytics.data.v1beta.IQueryAudienceExportRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IQueryAudienceExportRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.analytics.data.v1beta.IQueryAudienceExportResponse, protos.google.analytics.data.v1beta.IQueryAudienceExportRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
queryAudienceExport(request, callback)
queryAudienceExport(request: protos.google.analytics.data.v1beta.IQueryAudienceExportRequest, callback: Callback<protos.google.analytics.data.v1beta.IQueryAudienceExportResponse, protos.google.analytics.data.v1beta.IQueryAudienceExportRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IQueryAudienceExportRequest
|
callback |
Callback<protos.google.analytics.data.v1beta.IQueryAudienceExportResponse, protos.google.analytics.data.v1beta.IQueryAudienceExportRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
runPivotReport(request, options)
runPivotReport(request?: protos.google.analytics.data.v1beta.IRunPivotReportRequest, options?: CallOptions): Promise<[
protos.google.analytics.data.v1beta.IRunPivotReportResponse,
protos.google.analytics.data.v1beta.IRunPivotReportRequest | undefined,
{} | undefined
]>;
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.
Parameters | |
---|---|
Name | Description |
request |
IRunPivotReportRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.analytics.data.v1beta.IRunPivotReportResponse,
protos.google.analytics.data.v1beta.IRunPivotReportRequest | undefined,
{} | undefined
]> |
{Promise} - 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. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* 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 (https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
* Within a batch request, this property should either be unspecified or
* consistent with the batch-level property.
* Example: properties/1234
*/
// const property = 'abc123'
/**
* The dimensions requested. All defined dimensions must be used by one of the
* following: dimension_expression, dimension_filter, pivots, order_bys.
*/
// const dimensions = [1,2,3,4]
/**
* 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.
*/
// const metrics = [1,2,3,4]
/**
* 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.
*/
// const dateRanges = [1,2,3,4]
/**
* 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.
*/
// const pivots = [1,2,3,4]
/**
* The filter clause of dimensions. Dimensions must be requested to be used in
* this filter. Metrics cannot be used in this filter.
*/
// const dimensionFilter = {}
/**
* 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.
*/
// const metricFilter = {}
/**
* A currency code in ISO4217 format, such as "AED", "USD", "JPY".
* If the field is empty, the report uses the property's default currency.
*/
// const currencyCode = 'abc123'
/**
* Cohort group associated with this request. If there is a cohort group
* in the request the 'cohort' dimension must be present.
*/
// const cohortSpec = {}
/**
* 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.
* Regardless of this `keep_empty_rows` setting, only data recorded by the
* Google Analytics (GA4) property can be displayed in a report.
* For example if a property never logs a `purchase` event, then a query for
* the `eventName` dimension and `eventCount` metric will not have a row
* eventName: "purchase" and eventCount: 0.
*/
// const keepEmptyRows = true
/**
* Toggles whether to return the current state of this Analytics Property's
* quota. Quota is returned in PropertyQuota (#PropertyQuota).
*/
// const returnPropertyQuota = true
/**
* Optional. The configuration of comparisons requested and displayed. The
* request requires both a comparisons field and a comparisons dimension to
* receive a comparison column in the response.
*/
// const comparisons = [1,2,3,4]
// Imports the Data library
const {BetaAnalyticsDataClient} = require('@google-analytics/data').v1beta;
// Instantiates a client
const dataClient = new BetaAnalyticsDataClient();
async function callRunPivotReport() {
// Construct request
const request = {
};
// Run request
const response = await dataClient.runPivotReport(request);
console.log(response);
}
callRunPivotReport();
runPivotReport(request, options, callback)
runPivotReport(request: protos.google.analytics.data.v1beta.IRunPivotReportRequest, options: CallOptions, callback: Callback<protos.google.analytics.data.v1beta.IRunPivotReportResponse, protos.google.analytics.data.v1beta.IRunPivotReportRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IRunPivotReportRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.analytics.data.v1beta.IRunPivotReportResponse, protos.google.analytics.data.v1beta.IRunPivotReportRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
runPivotReport(request, callback)
runPivotReport(request: protos.google.analytics.data.v1beta.IRunPivotReportRequest, callback: Callback<protos.google.analytics.data.v1beta.IRunPivotReportResponse, protos.google.analytics.data.v1beta.IRunPivotReportRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IRunPivotReportRequest
|
callback |
Callback<protos.google.analytics.data.v1beta.IRunPivotReportResponse, protos.google.analytics.data.v1beta.IRunPivotReportRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
runRealtimeReport(request, options)
runRealtimeReport(request?: protos.google.analytics.data.v1beta.IRunRealtimeReportRequest, options?: CallOptions): Promise<[
protos.google.analytics.data.v1beta.IRunRealtimeReportResponse,
protos.google.analytics.data.v1beta.IRunRealtimeReportRequest | undefined,
{} | undefined
]>;
Returns a customized report of realtime event data for your property. Events appear in realtime reports seconds after they have been sent to the Google Analytics. Realtime reports show events and usage data for the periods of time ranging from the present moment to 30 minutes ago (up to 60 minutes for Google Analytics 360 properties).
For a guide to constructing realtime requests & understanding responses, see [Creating a Realtime Report](https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-basics).
Parameters | |
---|---|
Name | Description |
request |
IRunRealtimeReportRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.analytics.data.v1beta.IRunRealtimeReportResponse,
protos.google.analytics.data.v1beta.IRunRealtimeReportRequest | undefined,
{} | undefined
]> |
{Promise} - 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. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* 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 (https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
* Example: properties/1234
*/
// const property = 'abc123'
/**
* The dimensions requested and displayed.
*/
// const dimensions = [1,2,3,4]
/**
* The metrics requested and displayed.
*/
// const metrics = [1,2,3,4]
/**
* The filter clause of dimensions. Metrics cannot be used in this filter.
*/
// const dimensionFilter = {}
/**
* The filter clause of metrics. Applied at post aggregation phase, similar to
* SQL having-clause. Dimensions cannot be used in this filter.
*/
// const metricFilter = {}
/**
* The number of rows to return. If unspecified, 10,000 rows are returned. The
* API returns a maximum of 250,000 rows per request, no matter how many you
* ask for. `limit` must be positive.
* The API can also return fewer rows than the requested `limit`, if there
* aren't as many dimension values as the `limit`. For instance, there are
* fewer than 300 possible values for the dimension `country`, so when
* reporting on only `country`, you can't get more than 300 rows, even if you
* set `limit` to a higher value.
*/
// const limit = 1234
/**
* Aggregation of metrics. Aggregated metric values will be shown in rows
* where the dimension_values are set to "RESERVED_(MetricAggregation)".
*/
// const metricAggregations = [1,2,3,4]
/**
* Specifies how rows are ordered in the response.
*/
// const orderBys = [1,2,3,4]
/**
* Toggles whether to return the current state of this Analytics Property's
* Realtime quota. Quota is returned in PropertyQuota (#PropertyQuota).
*/
// const returnPropertyQuota = true
/**
* The minute ranges of event data to read. If unspecified, one minute range
* for the last 30 minutes will be used. If multiple minute ranges are
* requested, each response row will contain a zero based minute range index.
* If two minute ranges overlap, the event data for the overlapping minutes is
* included in the response rows for both minute ranges.
*/
// const minuteRanges = [1,2,3,4]
// Imports the Data library
const {BetaAnalyticsDataClient} = require('@google-analytics/data').v1beta;
// Instantiates a client
const dataClient = new BetaAnalyticsDataClient();
async function callRunRealtimeReport() {
// Construct request
const request = {
};
// Run request
const response = await dataClient.runRealtimeReport(request);
console.log(response);
}
callRunRealtimeReport();
runRealtimeReport(request, options, callback)
runRealtimeReport(request: protos.google.analytics.data.v1beta.IRunRealtimeReportRequest, options: CallOptions, callback: Callback<protos.google.analytics.data.v1beta.IRunRealtimeReportResponse, protos.google.analytics.data.v1beta.IRunRealtimeReportRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IRunRealtimeReportRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.analytics.data.v1beta.IRunRealtimeReportResponse, protos.google.analytics.data.v1beta.IRunRealtimeReportRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
runRealtimeReport(request, callback)
runRealtimeReport(request: protos.google.analytics.data.v1beta.IRunRealtimeReportRequest, callback: Callback<protos.google.analytics.data.v1beta.IRunRealtimeReportResponse, protos.google.analytics.data.v1beta.IRunRealtimeReportRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IRunRealtimeReportRequest
|
callback |
Callback<protos.google.analytics.data.v1beta.IRunRealtimeReportResponse, protos.google.analytics.data.v1beta.IRunRealtimeReportRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
runReport(request, options)
runReport(request?: protos.google.analytics.data.v1beta.IRunReportRequest, options?: CallOptions): Promise<[
protos.google.analytics.data.v1beta.IRunReportResponse,
protos.google.analytics.data.v1beta.IRunReportRequest | undefined,
{} | undefined
]>;
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.
For a guide to constructing requests & understanding responses, see [Creating a Report](https://developers.google.com/analytics/devguides/reporting/data/v1/basics).
Parameters | |
---|---|
Name | Description |
request |
IRunReportRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.analytics.data.v1beta.IRunReportResponse,
protos.google.analytics.data.v1beta.IRunReportRequest | undefined,
{} | undefined
]> |
{Promise} - 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. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* 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 (https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
* Within a batch request, this property should either be unspecified or
* consistent with the batch-level property.
* Example: properties/1234
*/
// const property = 'abc123'
/**
* The dimensions requested and displayed.
*/
// const dimensions = [1,2,3,4]
/**
* The metrics requested and displayed.
*/
// const metrics = [1,2,3,4]
/**
* 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.
*/
// const dateRanges = [1,2,3,4]
/**
* Dimension filters let you ask for only specific dimension values in
* the report. To learn more, see Fundamentals of Dimension
* Filters (https://developers.google.com/analytics/devguides/reporting/data/v1/basics#dimension_filters)
* for examples. Metrics cannot be used in this filter.
*/
// const dimensionFilter = {}
/**
* The filter clause of metrics. Applied after aggregating the report's rows,
* similar to SQL having-clause. Dimensions cannot be used in this filter.
*/
// const metricFilter = {}
/**
* The row count of the start row. The first row is counted as row 0.
* When paging, the first request does not specify offset; or equivalently,
* sets offset to 0; the first request returns the first `limit` of rows. The
* second request sets offset to the `limit` of the first request; the second
* request returns the second `limit` of rows.
* To learn more about this pagination parameter, see
* Pagination (https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
*/
// const offset = 1234
/**
* The number of rows to return. If unspecified, 10,000 rows are returned. The
* API returns a maximum of 250,000 rows per request, no matter how many you
* ask for. `limit` must be positive.
* The API can also return fewer rows than the requested `limit`, if there
* aren't as many dimension values as the `limit`. For instance, there are
* fewer than 300 possible values for the dimension `country`, so when
* reporting on only `country`, you can't get more than 300 rows, even if you
* set `limit` to a higher value.
* To learn more about this pagination parameter, see
* Pagination (https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
*/
// const limit = 1234
/**
* Aggregation of metrics. Aggregated metric values will be shown in rows
* where the dimension_values are set to "RESERVED_(MetricAggregation)".
*/
// const metricAggregations = [1,2,3,4]
/**
* Specifies how rows are ordered in the response.
*/
// const orderBys = [1,2,3,4]
/**
* A currency code in ISO4217 format, such as "AED", "USD", "JPY".
* If the field is empty, the report uses the property's default currency.
*/
// const currencyCode = 'abc123'
/**
* Cohort group associated with this request. If there is a cohort group
* in the request the 'cohort' dimension must be present.
*/
// const cohortSpec = {}
/**
* 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.
* Regardless of this `keep_empty_rows` setting, only data recorded by the
* Google Analytics (GA4) property can be displayed in a report.
* For example if a property never logs a `purchase` event, then a query for
* the `eventName` dimension and `eventCount` metric will not have a row
* eventName: "purchase" and eventCount: 0.
*/
// const keepEmptyRows = true
/**
* Toggles whether to return the current state of this Analytics Property's
* quota. Quota is returned in PropertyQuota (#PropertyQuota).
*/
// const returnPropertyQuota = true
/**
* Optional. The configuration of comparisons requested and displayed. The
* request only requires a comparisons field in order to receive a comparison
* column in the response.
*/
// const comparisons = [1,2,3,4]
// Imports the Data library
const {BetaAnalyticsDataClient} = require('@google-analytics/data').v1beta;
// Instantiates a client
const dataClient = new BetaAnalyticsDataClient();
async function callRunReport() {
// Construct request
const request = {
};
// Run request
const response = await dataClient.runReport(request);
console.log(response);
}
callRunReport();
runReport(request, options, callback)
runReport(request: protos.google.analytics.data.v1beta.IRunReportRequest, options: CallOptions, callback: Callback<protos.google.analytics.data.v1beta.IRunReportResponse, protos.google.analytics.data.v1beta.IRunReportRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IRunReportRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.analytics.data.v1beta.IRunReportResponse, protos.google.analytics.data.v1beta.IRunReportRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
runReport(request, callback)
runReport(request: protos.google.analytics.data.v1beta.IRunReportRequest, callback: Callback<protos.google.analytics.data.v1beta.IRunReportResponse, protos.google.analytics.data.v1beta.IRunReportRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IRunReportRequest
|
callback |
Callback<protos.google.analytics.data.v1beta.IRunReportResponse, protos.google.analytics.data.v1beta.IRunReportRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |