Google Search Ads Operators¶
Create, manage, and track high-impact campaigns across multiple search engines with one centralized tool. For more information check Google Search Ads.
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.
Querying a report¶
To query a Search Ads report use the
GoogleSearchAdsSearchOperator
.
query_report = GoogleSearchAdsSearchOperator(
task_id="query_report",
customer_id=CUSTOMER_ID,
query=QUERY,
)
You can use Jinja templating with
api_version
, gcp_conn_id
, page_token
, page_size
parameters which allows you to dynamically determine values.
Retrieve a field metadata¶
To retrieve metadata of a field use
GoogleSearchAdsGetFieldOperator
.
get_field = GoogleSearchAdsGetFieldOperator(
task_id="get_field",
field_name=FIELD_NAME,
)
You can use Jinja templating with
api_version
, gcp_conn_id
parameters which allows you to dynamically determine values.
Retrieve metadata for multiple fields¶
To retrieve metadata of multiple fields use the
GoogleSearchAdsSearchFieldsOperator
.
search_fields = GoogleSearchAdsSearchFieldsOperator(
task_id="search_fields",
query=SEARCH_FIELDS_QUERY,
)
You can use Jinja templating with
api_version
, gcp_conn_id
, page_token
, page_size
parameters which allows you to dynamically determine values.
Retrieve a custom column details¶
To retrieve details of a custom column use
GoogleSearchAdsGetCustomColumnOperator
.
get_custom_column = GoogleSearchAdsGetCustomColumnOperator(
task_id="get_custom_column",
customer_id=CUSTOMER_ID,
custom_column_id=CUSTOM_COLUMN_ID,
)
You can use Jinja templating with
api_version
, gcp_conn_id
parameters which allows you to dynamically determine values.
Retrieve a custom column details¶
To retrieve the list of all custom columns use
GoogleSearchAdsListCustomColumnsOperator
.
list_custom_columns = GoogleSearchAdsListCustomColumnsOperator(
task_id="list_custom_columns",
customer_id=CUSTOMER_ID,
)
You can use Jinja templating with
api_version
, gcp_conn_id
parameters which allows you to dynamically determine values.