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()[source]

Retrieve connection to Google Analytics 360.

list_accounts()[source]

List accounts list from Google Analytics 360.

Return 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[str, Any]

List 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[dict[str, Any]]

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

Upload 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(account_id, web_property_id, custom_data_source_id, delete_request_body)[source]

Delete 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(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?