blob: b07cedb005b2a52bc500bfdfa5f692e764e17799 [file] [log] [blame]
:py:mod:`airflow.providers.google.marketing_platform.operators.analytics`
=========================================================================
.. py:module:: airflow.providers.google.marketing_platform.operators.analytics
.. autoapi-nested-parse::
This module contains Google Analytics 360 operators.
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsListAccountsOperator
airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsGetAdsLinkOperator
airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsRetrieveAdsLinksListOperator
airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsDataImportUploadOperator
airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsDeletePreviousDataUploadsOperator
airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsModifyFileHeadersDataImportOperator
.. py:class:: GoogleAnalyticsListAccountsOperator(*, api_version = 'v3', gcp_conn_id = 'google_cloud_default', impersonation_chain = None, **kwargs)
Bases: :py:obj:`airflow.models.BaseOperator`
Lists all accounts to which the user has access.
.. seealso::
Check official API docs:
https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/accounts/list
and for python client
http://googleapis.github.io/google-api-python-client/docs/dyn/analytics_v3.management.accounts.html#list
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:GoogleAnalyticsListAccountsOperator`
:param api_version: The version of the api that will be requested for example 'v3'.
:param gcp_conn_id: The connection ID to use when fetching connection info.
:param impersonation_chain: 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).
.. py:attribute:: template_fields
:annotation: :Sequence[str] = ['api_version', 'gcp_conn_id', 'impersonation_chain']
.. py:method:: execute(context)
This is the main method to derive when creating an operator.
Context is the same dictionary used as when rendering jinja templates.
Refer to get_template_context for more context.
.. py:class:: 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)
Bases: :py:obj:`airflow.models.BaseOperator`
Returns a web property-Google Ads link to which the user has access.
.. seealso::
Check official API docs:
https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/webPropertyAdWordsLinks/get
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:GoogleAnalyticsGetAdsLinkOperator`
:param account_id: ID of the account which the given web property belongs to.
:param web_property_ad_words_link_id: Web property-Google Ads link ID.
:param web_property_id: Web property ID to retrieve the Google Ads link for.
:param impersonation_chain: 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).
.. py:attribute:: template_fields
:annotation: :Sequence[str] = ['api_version', 'gcp_conn_id', 'account_id', 'web_property_ad_words_link_id', 'web_property_id',...
.. py:method:: execute(context)
This is the main method to derive when creating an operator.
Context is the same dictionary used as when rendering jinja templates.
Refer to get_template_context for more context.
.. py:class:: GoogleAnalyticsRetrieveAdsLinksListOperator(*, account_id, web_property_id, api_version = 'v3', gcp_conn_id = 'google_cloud_default', impersonation_chain = None, **kwargs)
Bases: :py:obj:`airflow.models.BaseOperator`
Lists webProperty-Google Ads links for a given web property
.. seealso::
Check official API docs:
https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/webPropertyAdWordsLinks/list#http-request
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:GoogleAnalyticsRetrieveAdsLinksListOperator`
:param account_id: ID of the account which the given web property belongs to.
:param web_property_id: Web property UA-string to retrieve the Google Ads links for.
:param impersonation_chain: 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).
.. py:attribute:: template_fields
:annotation: :Sequence[str] = ['api_version', 'gcp_conn_id', 'account_id', 'web_property_id', 'impersonation_chain']
.. py:method:: execute(context)
This is the main method to derive when creating an operator.
Context is the same dictionary used as when rendering jinja templates.
Refer to get_template_context for more context.
.. py:class:: 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)
Bases: :py:obj:`airflow.models.BaseOperator`
Take a file from Cloud Storage and uploads it to GA via data import API.
:param storage_bucket: The Google cloud storage bucket where the file is stored.
:param storage_name_object: 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.
:param account_id: The GA account Id (long) to which the data upload belongs.
:param web_property_id: The web property UA-string associated with the upload.
:param custom_data_source_id: The id to which the data import belongs
:param resumable_upload: flag to upload the file in a resumable fashion, using a
series of at least two requests.
:param gcp_conn_id: The connection ID to use when fetching connection info.
:param delegate_to: 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.
:param api_version: The version of the api that will be requested for example 'v3'.
:param impersonation_chain: 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).
.. py:attribute:: template_fields
:annotation: :Sequence[str] = ['storage_bucket', 'storage_name_object', 'impersonation_chain']
.. py:method:: execute(context)
This is the main method to derive when creating an operator.
Context is the same dictionary used as when rendering jinja templates.
Refer to get_template_context for more context.
.. py:class:: 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)
Bases: :py:obj:`airflow.models.BaseOperator`
Deletes previous GA uploads to leave the latest file to control the size of the Data Set Quota.
:param account_id: The GA account Id (long) to which the data upload belongs.
:param web_property_id: The web property UA-string associated with the upload.
:param custom_data_source_id: The id to which the data import belongs.
:param gcp_conn_id: The connection ID to use when fetching connection info.
:param delegate_to: 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.
:param api_version: The version of the api that will be requested for example 'v3'.
:param impersonation_chain: 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).
.. py:attribute:: template_fields
:annotation: :Sequence[str] = ['impersonation_chain']
.. py:method:: execute(context)
This is the main method to derive when creating an operator.
Context is the same dictionary used as when rendering jinja templates.
Refer to get_template_context for more context.
.. py:class:: GoogleAnalyticsModifyFileHeadersDataImportOperator(storage_bucket, storage_name_object, gcp_conn_id = 'google_cloud_default', delegate_to = None, custom_dimension_header_mapping = None, impersonation_chain = None, **kwargs)
Bases: :py:obj:`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.
:param storage_bucket: The Google cloud storage bucket where the file is stored.
:param storage_name_object: 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.
:param gcp_conn_id: The connection ID to use when fetching connection info.
:param custom_dimension_header_mapping: 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.
:param delegate_to: 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.
:param impersonation_chain: 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).
.. py:attribute:: template_fields
:annotation: :Sequence[str] = ['storage_bucket', 'storage_name_object', 'impersonation_chain']
.. py:method:: execute(context)
This is the main method to derive when creating an operator.
Context is the same dictionary used as when rendering jinja templates.
Refer to get_template_context for more context.