Google Analytics 360 Operators¶
Google Analytics 360 operators allow you to lists all accounts to which the user has access. For more information about the Google Analytics 360 API check official documentation.
Prerequisite Tasks¶
To use these operators, you must do a few things:
Select or create a Cloud Platform project using the Cloud Console.
Enable billing for your project, as described in the Google Cloud documentation.
Enable the API, as described in the Cloud Console documentation.
Install API libraries via pip.
pip install 'apache-airflow[google]'Detailed information is available for Installation.
List the Accounts¶
To list accounts from Analytics you can use the
GoogleAnalyticsListAccountsOperator
.
list_account = GoogleAnalyticsListAccountsOperator(task_id="list_account")
You can use Jinja templating with
api_version
, gcp_conn_id
, impersonation_chain
Get Ad Words Link¶
Returns a web property-Google Ads link to which the user has access.
To list web property-Google Ads link you can use the
GoogleAnalyticsGetAdsLinkOperator
.
get_ad_words_link = GoogleAnalyticsGetAdsLinkOperator(
web_property_ad_words_link_id=WEB_PROPERTY_AD_WORDS_LINK_ID,
web_property_id=WEB_PROPERTY_ID,
account_id=ACCOUNT_ID,
task_id="get_ad_words_link",
)
You can use Jinja templating with
api_version
, gcp_conn_id
, account_id
, web_property_ad_words_link_id
, web_property_id
, impersonation_chain
List Google Ads Links¶
Operator returns a list of entity Google Ads links.
To list Google Ads links you can use the
GoogleAnalyticsRetrieveAdsLinksListOperator
.
list_ad_words_link = GoogleAnalyticsRetrieveAdsLinksListOperator(
task_id="list_ad_link", account_id=ACCOUNT_ID, web_property_id=WEB_PROPERTY_ID
)
You can use Jinja templating with
api_version
, gcp_conn_id
, account_id
, web_property_id
, impersonation_chain