airflow.providers.google.marketing_platform.operators.analytics

This module contains Google Analytics 360 operators.

Module Contents

Classes

GoogleAnalyticsListAccountsOperator

Lists all accounts to which the user has access.

GoogleAnalyticsGetAdsLinkOperator

Returns a web property-Google Ads link to which the user has access.

GoogleAnalyticsRetrieveAdsLinksListOperator

Lists webProperty-Google Ads links for a given web property.

GoogleAnalyticsDataImportUploadOperator

Take a file from Cloud Storage and uploads it to GA via data import API.

GoogleAnalyticsDeletePreviousDataUploadsOperator

Deletes previous GA uploads to leave the latest file to control the size of the Data Set Quota.

GoogleAnalyticsModifyFileHeadersDataImportOperator

GA has a very particular naming convention for Data Import.

class airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsListAccountsOperator(*, api_version='v3', gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Lists all accounts to which the user has access.

See also

This operator is deprecated, please use GoogleAnalyticsAdminListAccountsOperator:

See also

For more information on how to use this operator, take a look at the guide: List the Accounts

Parameters
  • api_version (str) – The version of the api that will be requested for example ‘v3’.

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • impersonation_chain (str | Sequence[str] | None) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

template_fields: Sequence[str] = ('api_version', 'gcp_conn_id', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsGetAdsLinkOperator(*, account_id, web_property_ad_words_link_id, web_property_id, api_version='v3', gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Returns a web property-Google Ads link to which the user has access.

See also

This operator is deprecated, please use GoogleAnalyticsAdminGetGoogleAdsLinkOperator:

See also

For more information on how to use this operator, take a look at the guide: Get Ad Words Link

Parameters
  • account_id (str) – ID of the account which the given web property belongs to.

  • web_property_ad_words_link_id (str) – Web property-Google Ads link ID.

  • web_property_id (str) – Web property ID to retrieve the Google Ads link for.

  • impersonation_chain (str | Sequence[str] | None) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

template_fields: Sequence[str] = ('api_version', 'gcp_conn_id', 'account_id', 'web_property_ad_words_link_id', 'web_property_id',...[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsRetrieveAdsLinksListOperator(*, account_id, web_property_id, api_version='v3', gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Lists webProperty-Google Ads links for a given web property.

See also

This operator is deprecated, please use GoogleAnalyticsAdminListGoogleAdsLinksOperator:

See also

For more information on how to use this operator, take a look at the guide: List Google Ads Links

Parameters
  • account_id (str) – ID of the account which the given web property belongs to.

  • web_property_id (str) – Web property UA-string to retrieve the Google Ads links for.

  • impersonation_chain (str | Sequence[str] | None) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

template_fields: Sequence[str] = ('api_version', 'gcp_conn_id', 'account_id', 'web_property_id', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsDataImportUploadOperator(*, storage_bucket, storage_name_object, account_id, web_property_id, custom_data_source_id, resumable_upload=False, gcp_conn_id='google_cloud_default', delegate_to=None, api_version='v3', impersonation_chain=None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Take a file from Cloud Storage and uploads it to GA via data import API.

See also

This operator is deprecated, please use GoogleAnalyticsAdminCreateDataStreamOperator:

Parameters
  • storage_bucket (str) – The Google cloud storage bucket where the file is stored.

  • storage_name_object (str) – The name of the object in the desired Google cloud storage bucket. (templated) If the destination points to an existing folder, the file will be taken from the specified folder.

  • account_id (str) – The GA account Id (long) to which the data upload belongs.

  • web_property_id (str) – The web property UA-string associated with the upload.

  • custom_data_source_id (str) – The id to which the data import belongs

  • resumable_upload (bool) – flag to upload the file in a resumable fashion, using a series of at least two requests.

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • delegate_to (str | None) – The account to impersonate using domain-wide delegation of authority, if any. For this to work, the service account making the request must have domain-wide delegation enabled.

  • api_version (str) – The version of the api that will be requested for example ‘v3’.

  • impersonation_chain (str | Sequence[str] | None) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

template_fields: Sequence[str] = ('storage_bucket', 'storage_name_object', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsDeletePreviousDataUploadsOperator(account_id, web_property_id, custom_data_source_id, gcp_conn_id='google_cloud_default', delegate_to=None, api_version='v3', impersonation_chain=None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Deletes previous GA uploads to leave the latest file to control the size of the Data Set Quota.

See also

This operator is deprecated, please use GoogleAnalyticsAdminDeleteDataStreamOperator:

Parameters
  • account_id (str) – The GA account Id (long) to which the data upload belongs.

  • web_property_id (str) – The web property UA-string associated with the upload.

  • custom_data_source_id (str) – The id to which the data import belongs.

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • delegate_to (str | None) – The account to impersonate using domain-wide delegation of authority, if any. For this to work, the service account making the request must have domain-wide delegation enabled.

  • api_version (str) – The version of the api that will be requested for example ‘v3’.

  • impersonation_chain (str | Sequence[str] | None) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

template_fields: Sequence[str] = ('impersonation_chain',)[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsModifyFileHeadersDataImportOperator(storage_bucket, storage_name_object, gcp_conn_id='google_cloud_default', delegate_to=None, custom_dimension_header_mapping=None, impersonation_chain=None, **kwargs)[source]

Bases: airflow.models.BaseOperator

GA has a very particular naming convention for Data Import.

Ability to prefix “ga:” to all column headers and also a dict to rename columns to match the custom dimension ID in GA i.e clientId : dimensionX.

Parameters
  • storage_bucket (str) – The Google cloud storage bucket where the file is stored.

  • storage_name_object (str) – The name of the object in the desired Google cloud storage bucket. (templated) If the destination points to an existing folder, the file will be taken from the specified folder.

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • custom_dimension_header_mapping (dict[str, str] | None) – Dictionary to handle when uploading custom dimensions which have generic IDs ie. ‘dimensionX’ which are set by GA. Dictionary maps the current CSV header to GA ID which will be the new header for the CSV to upload to GA eg clientId : dimension1.

  • delegate_to (str | None) – The account to impersonate using domain-wide delegation of authority, if any. For this to work, the service account making the request must have domain-wide delegation enabled.

  • impersonation_chain (str | Sequence[str] | None) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

template_fields: Sequence[str] = ('storage_bucket', 'storage_name_object', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

Was this entry helpful?