Filter by campaign type in adwords api reporting python

108 views
Skip to first unread message

Praveen Jose

unread,
Jun 19, 2019, 3:46:45 AM6/19/19
to AdWords API and Google Ads API Forum
Hi Guys,


I am reaching out since I am in need of some guidance here. 


I am using the python code package to pull a criteria performance report . However i have a requirement to filter by Campaign type = 'Display Only' for this report generation


Could you please advise me as to how I can achieve this within my selector?


Thanks,


Praveen

Google Ads API Forum Advisor Prod

unread,
Jun 19, 2019, 1:01:45 PM6/19/19
to adwor...@googlegroups.com
Hello Praveen,

The CampaignType field is not available in the criteria performance report. However to get an idea on using predicates with selector I am filtering the results with CriteriaType filed. Please find my report definition below.
report = {
    'reportName': 'Last 7 days CRITERIA_PERFORMANCE_REPORT',
    'dateRangeType': 'LAST_7_DAYS',
    'reportType': 'CRITERIA_PERFORMANCE_REPORT',
    'downloadFormat': 'CSV',
    'selector': {
        'fields': ['CampaignId', 'AdGroupId', 'Id', 'CriteriaType',
                   'Criteria', 'FinalUrls', 'Impressions', 'Clicks', 'Cost'],
    'predicates': [{
        'field': 'CriteriaType',
        'operator': 'EQUALS',
        'values': ['KEYWORD']
    }]
    }
}

Please let me know if you have any further questions.

Regards,
Sai Teja, Google Ads API Team


ref:_00D1U1174p._5001UBo9Ky:ref

Praveen Jose

unread,
Jun 21, 2019, 9:22:56 AM6/21/19
to AdWords API and Google Ads API Forum
Hi Sai,


Could you let me know the status of my query? Thanks and much appreicated


Regards,

Praveen

Google Ads API Forum Advisor Prod

unread,
Jun 21, 2019, 1:20:00 PM6/21/19
to adwor...@googlegroups.com
Hello Praveen,

The CampaignType field is not available in the criteria performance report, hence it is not possible to filter by CampaignType field. However to get an idea on using predicates with selector I am filtering the results with CriteriaType filed. Please find my report definition below.

Praveen Jose

unread,
Jun 24, 2019, 1:48:30 AM6/24/19
to AdWords API and Google Ads API Forum
Hi Sai,

I understand that CampaignType is not a field that can be filtered on for Criteria performance report. I wanted to know if there is any other possible solution or workaround which can accomplish the Display only campaigntypes to be filtered for my report generation


Thanks,


Praveen

On Wednesday, June 19, 2019 at 1:16:45 PM UTC+5:30, Praveen Jose wrote:

Google Ads API Forum Advisor Prod

unread,
Jun 24, 2019, 10:06:26 AM6/24/19
to adwor...@googlegroups.com
Hello Praveen,

Since you have CampaignId field available in the Criteria performance report. You can filter via the AdvertisingChannelType field of the CampaignPerformanceReport and then use the campaign ids to filter in the Criteria Performance Report. You have to perform 2 report calls in this use case.

Also, you can use CampaignService.get to filter the display campaigns using advertisingChannelType and get the campaign ids. Please let me know if you have any further questions.

Praveen Jose

unread,
Jun 25, 2019, 3:01:10 AM6/25/19
to AdWords API and Google Ads API Forum
Hi ,


Thanks for the information.

Is there any python code sample which illustrates the options provided?

Thanks,

Praveen

On Wednesday, June 19, 2019 at 1:16:45 PM UTC+5:30, Praveen Jose wrote:

Google Ads API Forum Advisor Prod

unread,
Jun 25, 2019, 3:50:06 PM6/25/19
to adwor...@googlegroups.com
Hello Praveen,

There are no specific code samples for this scenario but in general to get the reports you can refer this code sample in Python language. To filter and to fetch the campaign Ids for display campaigns you can refer my example query below.
Query: SELECT CampaignId FROM CAMPAIGN_PERFORMANCE_REPORT WHERE AdvertisingChannelType = "DISPLAY" DURING LAST_30_DAYS

Then use those Ids and can filter in the CriteriaPerformanceReport. Please give it a try and let me know if you have any further questions.

Praveen Jose

unread,
Jul 4, 2019, 6:36:59 AM7/4/19
to AdWords API and Google Ads API Forum
Hi Sai,

I wrote the campaign ids generated into a file for AdvertisingChannelType = "DISPLAY"


How do i feed  these campaign ids (which are many) into the report structure to pull a criteria performance report? I would need your assistance here


Thanks,

Praveen 

Google Ads API Forum Advisor Prod

unread,
Jul 8, 2019, 11:22:29 AM7/8/19
to adwor...@googlegroups.com
Hello Praveen,

Once you got the ids of those display campaigns, you can apply filter on the CampaignId field on the CriterionPerformacneReport by adding the where condition in the report query(example given below). You could use the code sample in JAVA from here

.where("CampaignId").in("1591618263", "1382949293", "1744060782", "1591618263") 

Please let me know if you have any further questions.

Praveen Jose

unread,
Jul 11, 2019, 5:34:47 AM7/11/19
to AdWords API and Google Ads API Forum
Hi Sai,


Thanks for the details

I am able to generate the report now but I am seeing inconsistencies with the data from the UI console and the report that is generated by connecting to the Adwords API

Should I provide a specific combination of data for which I am seeing the inconsistencies?

Thanks,

Praveen

On Wednesday, June 19, 2019 at 1:16:45 PM UTC+5:30, Praveen Jose wrote:

Google Ads API Forum Advisor Prod

unread,
Jul 11, 2019, 6:32:39 AM7/11/19
to adwor...@googlegroups.com
Hi Praveen,

I am a colleague of Sai, allow me to provide support for your concern.

To better investigate the issue, could you provide your complete report definition, clientCustomerId used, and the screenshot of the report discrepancies in the UI? You may use the reply privately to author option.

Regards,
Dannison

Google Ads API Team

ref:_00D1U1174p._5001U8KkQI:ref

Praveen Jose

unread,
Jul 17, 2019, 2:57:11 AM7/17/19
to AdWords API and Google Ads API Forum
Hi Guys,

Any update?

On Wednesday, June 19, 2019 at 1:16:45 PM UTC+5:30, Praveen Jose wrote:

Google Ads API Forum Advisor Prod

unread,
Jul 17, 2019, 5:11:08 AM7/17/19
to adwor...@googlegroups.com
Hi Praveen,

My apologies for the inconvenience. However, it seems that you are not able to receive my private messages. Forwarding my response below.

"My apologies as I would need the requested information so I could further investigate this.

Could you provide your clientCustomerId that was used to download the report, and a complete screenshot of the report discrepancies in the UI?"

Kindly use the reply privately to author option, and I will provide the solution in this public thread. Kindly take note that the Criteria Performance Report is not supported in the Google Ads UI.

Google Ads API Forum Advisor Prod

unread,
Jul 17, 2019, 6:31:51 AM7/17/19
to adwor...@googlegroups.com
Hi Praveen,

Thank you for providing the clientCustomerId privately. 

Just to clear things out, you are trying to compare the report (TUI_Display_GDN_Weekly) generated in your UI with the Criteria Performance Report you are trying to generate in the API.

If this is what you are trying to do, I am afraid you cannot compare the Criteria Performance Report in the UI because the UI does not support this type of report. Upon checking the report in your account, this does not resemble any API reports. You can refer to your mapping guide for the list of reports in the API that maps to the UI.

Google Ads API Forum Advisor Prod

unread,
Jul 17, 2019, 10:38:37 PM7/17/19
to adwor...@googlegroups.com
Hi Praveen,

Even though the the columns in your UI report matches with the fields in your Criteria Performance Report, this may still not return the same report metrics as the Criteria Performance Reports generate metrics on the criteria level. If you wish to retrieve criteria specific reports, you can refer to this link. You can only compare reports generated from the API to the UI if it is one of these reports in the mapping guide.

Google Ads API Forum Advisor Prod

unread,
Jul 18, 2019, 9:51:18 PM7/18/19
to adwor...@googlegroups.com
Hi Praveen,

Upon checking your report, I would recommend using the Ad Group Performance Report to replicate the report TUI_Display_GDN_Weekly in your Google Ads UI. You may refer to the query below.

AWQL : SELECT Date, AdGroupStatus, AdGroupName, CampaignName, CampaignStatus, CpcBid, CpvBid, CpmBid, EffectiveTargetRoas, TargetCpa, Clicks, Impressions, Cost, AdGroupId FROM ADGROUP_PERFORMANCE_REPORT WHERE AdGroupType IN ['DISPLAY_STANDARD', 'DISPLAY_ENGAGEMENT'] DURING LAST_7_DAYS

Take note that this is not the exact report equivalent in the UI, metrics may differ a little from your actual report. Let me know if this helps.


Regards,
Dannison
Google Ads API Team


ref:_00D1U1174p._5001U8KkQI:ref
Reply all
Reply to author
Forward
0 new messages