airflow.providers.google.marketing_platform.hooks.analytics

Module Contents

Classes

GoogleAnalyticsHook

Hook for Google Analytics 360.

class airflow.providers.google.marketing_platform.hooks.analytics.GoogleAnalyticsHook(api_version='v3', *args, **kwargs)[source]

Bases: airflow.providers.google.common.hooks.base_google.GoogleBaseHook

Hook for Google Analytics 360.

get_conn(self)[source]

Retrieves connection to Google Analytics 360.

list_accounts(self)[source]

Lists accounts list from Google Analytics 360.

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

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

  • web_property_id (str) -- Web property-Google Ads link UA-string.

  • web_property_ad_words_link_id (str) -- to retrieve the Google Ads link for.

Returns

web property-Google Ads

Return type

Dict

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

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.

Returns

list of entity Google Ads links.

Return type

list

upload_data(self, file_location, account_id, web_property_id, custom_data_source_id, resumable_upload=False)[source]

Uploads file to GA via the Data Import API

Parameters
  • file_location (str) -- The path and name of the file to upload.

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

  • web_property_id (str) -- UA-string associated with the upload.

  • custom_data_source_id (str) -- Custom Data Source Id to which this data import belongs.

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

delete_upload_data(self, account_id, web_property_id, custom_data_source_id, delete_request_body)[source]

Deletes the uploaded data for a given account/property/dataset

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

  • web_property_id (str) -- UA-string associated with the upload.

  • custom_data_source_id (str) -- Custom Data Source Id to which this data import belongs.

  • delete_request_body (Dict[str, Any]) -- Dict of customDataImportUids to delete.

list_uploads(self, account_id, web_property_id, custom_data_source_id)[source]

Get list of data upload from GA

Parameters
  • account_id -- The GA account Id to which the data upload belongs.

  • web_property_id -- UA-string associated with the upload.

  • custom_data_source_id -- Custom Data Source Id to which this data import belongs.

Was this entry helpful?