Joshua Dance
Joshua Dance

Reputation: 10532

Pull list of campaigns from Google Adwords API?

The Google Adwords API documentation is super difficult to navigate.

I know I am missing something. How can I pull a list of the campaigns under a certain account? Is there a report that includes it or API call? I can use a list of IDs or names but I can't find either.

Upvotes: 2

Views: 3273

Answers (1)

ge7600
ge7600

Reputation: 399

Take a look at Google's googleads github repo.

https://github.com/googleads/googleads-python-lib/blob/master/examples/adwords/v201506/reporting/download_criteria_report.py

This is an example of downloading a criteria performance report.

  1. Change reportType to CAMPAIGN_PERFORMANCE_REPORT.
  2. In the selector object, change fields to the fields you want out of the list - https://developers.google.com/adwords/api/docs/appendix/reports/campaign-performance-report
  3. If you want to add an id filter then you need to add a predicates object to the selector that looks like:

    {'field': 'CampaignId', 'operator': 'IN', 'values': campaign_ids}

Not all fields in the campaign are available in the reporting section. In this case I would suggest to use the campaign service to download the campaigns. Keep in mind that this operation is slower than reporting.

Take a look at this example from the googleads repo - https://github.com/googleads/googleads-python-lib/blob/master/examples/adwords/v201506/basic_operations/get_campaigns.py

Upvotes: 2

Related Questions