Class v1alpha.AlphaAnalyticsDataClient (3.2.1)

Google Analytics reporting data service. v1alpha

Package

@google-analytics/data

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of AlphaAnalyticsDataClient.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof gax.fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new AlphaAnalyticsDataClient({fallback: 'rest'}, gax); ```

Properties

alphaAnalyticsDataStub

alphaAnalyticsDataStub?: Promise<{
        [name: string]: Function;
    }>;

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

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.

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

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
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
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
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

runFunnelReport(request, options)

runFunnelReport(request?: protos.google.analytics.data.v1alpha.IRunFunnelReportRequest, options?: CallOptions): Promise<[
        protos.google.analytics.data.v1alpha.IRunFunnelReportResponse,
        protos.google.analytics.data.v1alpha.IRunFunnelReportRequest | undefined,
        {} | undefined
    ]>;

Returns a customized funnel report of your Google Analytics event data. The data returned from the API is as a table with columns for the requested dimensions and metrics.

Funnel exploration lets you visualize the steps your users take to complete a task and quickly see how well they are succeeding or failing at each step. For example, how do prospects become shoppers and then become buyers? How do one time buyers become repeat buyers? With this information, you can improve inefficient or abandoned customer journeys. To learn more, see [GA4 Funnel Explorations](https://support.google.com/analytics/answer/9327974).

Parameters
NameDescription
request protos.google.analytics.data.v1alpha.IRunFunnelReportRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.analytics.data.v1alpha.IRunFunnelReportResponse, protos.google.analytics.data.v1alpha.IRunFunnelReportRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * 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'
  /**
   *  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.
   */
  // const dateRanges = 1234
  /**
   *  The configuration of this request's funnel. This funnel configuration is
   *  required.
   */
  // const funnel = {}
  /**
   *  If specified, this breakdown adds a dimension to the funnel table sub
   *  report response. This breakdown dimension expands each funnel step to the
   *  unique values of the breakdown dimension. For example, a breakdown by the
   *  `deviceCategory` dimension will create rows for `mobile`, `tablet`,
   *  `desktop`, and the total.
   */
  // const funnelBreakdown = {}
  /**
   *  If specified, next action adds a dimension to the funnel visualization sub
   *  report response. This next action dimension expands each funnel step to the
   *  unique values of the next action. For example a next action of the
   *  `eventName` dimension will create rows for several events (i.e.
   *  `session_start` & `click`) and the total.
   *  Next action only supports `eventName` and most Page / Screen dimensions
   *  like `pageTitle` and `pagePath`.
   */
  // const funnelNextAction = {}
  /**
   *  The funnel visualization type controls the dimensions present in the funnel
   *  visualization sub report response. If not specified, `STANDARD_FUNNEL` is
   *  used.
   */
  // const funnelVisualizationType = {}
  /**
   *  The configurations of segments. Segments are subsets of a property's data.
   *  In a funnel report with segments, the funnel is evaluated in each segment.
   *  Each segment specified in this request
   *  produces a separate row in the response; in the response, each segment
   *  identified by its name.
   *  The segments parameter is optional. Requests are limited to 4 segments.
   */
  // const segments = 1234
  /**
   *  The number of rows to return. If unspecified, 10,000 rows are returned. The
   *  API returns a maximum of 100,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`.
   */
  // const limit = 1234
  /**
   *  Dimension filters allow you to ask for only specific dimension values in
   *  the report. To learn more, see Creating a Report: 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 = {}
  /**
   *  Toggles whether to return the current state of this Analytics Property's
   *  quota. Quota is returned in PropertyQuota (#PropertyQuota).
   */
  // const returnPropertyQuota = true

  // Imports the Data library
  const {AlphaAnalyticsDataClient} = require('@google-cloud/data').v1alpha;

  // Instantiates a client
  const dataClient = new AlphaAnalyticsDataClient();

  async function callRunFunnelReport() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await dataClient.runFunnelReport(request);
    console.log(response);
  }

  callRunFunnelReport();

runFunnelReport(request, options, callback)

runFunnelReport(request: protos.google.analytics.data.v1alpha.IRunFunnelReportRequest, options: CallOptions, callback: Callback<protos.google.analytics.data.v1alpha.IRunFunnelReportResponse, protos.google.analytics.data.v1alpha.IRunFunnelReportRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.analytics.data.v1alpha.IRunFunnelReportRequest
options CallOptions
callback Callback<protos.google.analytics.data.v1alpha.IRunFunnelReportResponse, protos.google.analytics.data.v1alpha.IRunFunnelReportRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

runFunnelReport(request, callback)

runFunnelReport(request: protos.google.analytics.data.v1alpha.IRunFunnelReportRequest, callback: Callback<protos.google.analytics.data.v1alpha.IRunFunnelReportResponse, protos.google.analytics.data.v1alpha.IRunFunnelReportRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.analytics.data.v1alpha.IRunFunnelReportRequest
callback Callback<protos.google.analytics.data.v1alpha.IRunFunnelReportResponse, protos.google.analytics.data.v1alpha.IRunFunnelReportRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void