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

Inserting a report

To insert a Search Ads report use the GoogleSearchAdsInsertReportOperator.

tests/system/providers/google/marketing_platform/example_search_ads.py[source]

generate_report = GoogleSearchAdsInsertReportOperator(report=REPORT, task_id="generate_report")

You can use Jinja templating with report, impersonation_chain parameters which allows you to dynamically determine values. You can provide report definition using `` .json`` file as this operator supports this template extension. The result is saved to XCom, which allows it to be used by other operators:

tests/system/providers/google/marketing_platform/example_search_ads.py[source]

report_id = cast(str, XComArg(generate_report, key="report_id"))

Awaiting for a report

To wait for a report to be ready for download use GoogleSearchAdsReportSensor.

tests/system/providers/google/marketing_platform/example_search_ads.py[source]

wait_for_report = GoogleSearchAdsReportSensor(report_id=report_id, task_id="wait_for_report")

You can use Jinja templating with report_id, impersonation_chain parameters which allows you to dynamically determine values.

Downloading a report

To download a Search Ads report to Google Cloud Storage bucket use the GoogleSearchAdsDownloadReportOperator.

tests/system/providers/google/marketing_platform/example_search_ads.py[source]

download_report = GoogleSearchAdsDownloadReportOperator(
    report_id=report_id, bucket_name=GCS_BUCKET, task_id="download_report"
)

You can use Jinja templating with report_name, report_id, bucket_name, impersonation_chain parameters which allows you to dynamically determine values. The result is saved to XCom, which allows it to be used by other operators.

Was this entry helpful?