Skip to content

Googlea4

flowtask.components.GoogleA4

GoogleA4

GoogleA4(loop=None, job=None, stat=None, **kwargs)

Bases: QSBase

GoogleA4

Overview

The GoogleA4 class is a component for interacting with Google Analytics 4 (GA4) to fetch and transform report data.
It extends the QSBase class and provides methods for retrieving reports and transforming the data into a specified format.

.. table:: Properties :widths: auto

+--------------+----------+-----------+----------------------------------------------------------+ | Name | Required | Summary | +--------------+----------+-----------+----------------------------------------------------------+ | datalist | Yes | Method for reports | +--------------+----------+-----------+----------------------------------------------------------+ | subtask | Yes | Identifiers of property and metrics | +--------------+----------+-----------+----------------------------------------------------------+ | type | Yes | Defines the type of data handled by the component, set to "report". | +--------------+----------+-----------+----------------------------------------------------------+ | _driver | Yes | Specifies the driver used by the component, set to "ga". | +--------------+----------+-----------+----------------------------------------------------------+ | _metrics | Yes | A dictionary mapping GA4 metrics to their corresponding output names.| +--------------+----------+-----------+----------------------------------------------------------+ | _qs | Yes | Instance of the QSBase class used to interact with the data source. | +--------------+----------+-----------+----------------------------------------------------------+

Raises:
    DataNotFound: If no data is found.
    ComponentError: If any other error occurs during execution.

Return

The methods in this class return the requested report data from Google Analytics 4, formatted according to the specific requirements of the component.

Example:

```yaml
GoogleA4:
  type: report
  property_id: '306735132'
  pattern:
    start_date:
    - date_diff
    - value: now
      diff: 14
      mode: days
      mask: '%Y-%m-%d'
    end_date:
    - today
    - mask: '%Y-%m-%d'
  dimensions:
  - mobileDeviceBranding
  - mobileDeviceModel
  metric:
  - sessions
  - totalUsers
  - newUsers
  - engagedSessions
  - sessionsPerUser
  company_id: 52
  ga4_dimension: 10
```