Google Ads Operators¶
Google Ads, formerly Google AdWords and Google AdWords Express, is a platform which allows businesses to advertise on Google Search, YouTube and other sites across the web.
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.
Google Ads to GCS¶
To query the Google Ads API and generate a CSV report of the results use GoogleAdsToGcsOperator
.
run_operator = GoogleAdsToGcsOperator(
client_ids=CLIENT_IDS,
query=QUERY,
attributes=FIELDS_TO_EXTRACT,
obj=GCS_OBJ_PATH,
bucket=BUCKET_NAME,
task_id="run_operator",
)
Use Jinja templating with those parameters which allow you to dynamically determine values:
client_ids
query
attributes
bucket
obj
impersonation_chain
The result is saved to XCom, which allows the result to be used by other operators.
Upload Google Ads Accounts to GCS¶
To upload Google Ads accounts to Google Cloud Storage bucket use the
GoogleAdsListAccountsOperator
.
list_accounts = GoogleAdsListAccountsOperator(
task_id="list_accounts", bucket=BUCKET_NAME, object_name=GCS_ACCOUNTS_CSV
)
Use Jinja templating with those parameters which allow you to dynamically determine values:
bucket
object_name
impersonation_chain
parameters which allow you to dynamically determine values. The result is saved to XCom, which allows the result to be used by other operators.