Ad group label filter for ad performance report

205 views
Skip to first unread message

harish....@latentview.com

unread,
Nov 14, 2017, 5:05:21 AM11/14/17
to AdWords API Forum
Is it possible to apply adgroup label filter while downloading ad performance report? (This is not possible using the UI)

This email may contain confidential and privileged information for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please reply back to the sender about the error and delete all copies of this email message. Thank you.

Bharani Cherukuri (AdWords API Team)

unread,
Nov 14, 2017, 11:41:06 AM11/14/17
to AdWords API Forum
Hello Harish, 

The AdGroup Label manages the labels associated with an AdGroup. The Ad Performance Report includes all the statistics aggregated at the ad level, one per ad. The list of Labels and LabelIds are associated with the ad in that row. If you wish to filter based on AdGroup label, I'd suggest that you use the AdGroup Performance Report by filtering based on the LabelIds or Labels fields. 

Regards,
Bharani, AdWords API Team

harish....@latentview.com

unread,
Nov 15, 2017, 12:01:43 AM11/15/17
to AdWords API Forum
Hello Bharani,

Thanks for taking time in writing back to me. 

If I consider AdGroup Performance Report then I will not get the statistics aggregated at the ad level. I'm new to AdWords API, so it will be very helpful if we can get on a quick call. My Mobile - +91 8939546514. Thanks for your help!

Bharani Cherukuri (AdWords API Team)

unread,
Nov 15, 2017, 12:47:30 PM11/15/17
to AdWords API Forum
Hi Harish, 

That's right, with the AdGroup Performance Report, you will be able to retrieve statistics aggregated at the Ad group level with one row per ad group. You can take a look at the available Report types and our Reporting code samples in Java here. Code samples in other languages are also available here. I'm afraid, we will not be able to provide call support at the moment. Feel free to mention your concerns on this forum and you will get a response promptly. 

Regards,
Bharani, AdWords API Team

On Tuesday, November 14, 2017 at 5:05:21 AM UTC-5, harish....@latentview.com wrote:

harish....@latentview.com

unread,
Nov 15, 2017, 11:12:35 PM11/15/17
to AdWords API Forum
Oh. We miss having ad group label filter in ad report.
I want to know which python file should I use for downloading report. I see the following,
download_criteria_report_as_stream_with_awql.py
download_criteria_report_as_stream_with_selector.py
download_criteria_report_as_string_with_awql.py
download_criteria_report_as_string_with_selector.py
download_criteria_report_with_awql.py
download_criteria_report_with_selector.py
get_report_fields.py
parallel_report_download.py

Would you mind explaining these? I read the docs given but I could not understand. Thanks!
Message has been deleted

Bharani Cherukuri (AdWords API Team)

unread,
Nov 16, 2017, 2:38:21 PM11/16/17
to AdWords API Forum
Hi Harish, 

Can you confirm which version of the googleads-python client library are you using. The ReportQueryBuilder change was introduced in v9.0.0. If you're using an earlier version of the library and trying to use the samples from the latest version, you might encounter this error.


Regards,
Bharani, AdWords API Team

On Tuesday, November 14, 2017 at 5:05:21 AM UTC-5, harish....@latentview.com wrote:

harish....@latentview.com

unread,
Nov 21, 2017, 12:51:08 AM11/21/17
to AdWords API Forum
Hi Bharani,
The below is the code that I used. Please guide me so that I can download ad report with necessary columns and metrics.

import sys
from googleads import adwords

def main(client):
    # Initialize appropriate service.
    report_downloader = client.GetReportDownloader(version='v201710')

    # Create report query.
    report_query = (adwords.ReportQueryBuilder()
                  .Select('AdGroupName','Labels','Impressions', 'Clicks','Cost')
                  .From('AD_PERFORMANCE_REPORT')
                  .Where('Status').In('ENABLED', 'PAUSED')
                  .During('LAST_7_DAYS')
                  .Build())

    # You can provide a file object to write the output to. For this
    # demonstration we use sys.stdout to write the report to the screen.
    result = report_downloader.DownloadReportAsStringWithAwql(report_query, 'CSV', skip_report_header=False, 
                                                            skip_column_header=False,skip_report_summary=False, 
                                                            include_zero_impressions=True)
    file_path = 'my path'
    with open(file_path, 'w') as out_file:
        out_file.write(result)

if __name__ == '__main__':
  # Initialize client object.
    adwords_client = adwords.AdWordsClient.LoadFromStorage(path of credentials.yaml")
    adwords_client.client_customer_id = 'my id goes here'
    main(adwords_client)
Thanks!

Bharani Cherukuri (AdWords API Team)

unread,
Nov 21, 2017, 12:48:32 PM11/21/17
to AdWords API Forum
Hi Harish, 

Can you try the query from this code sample and see if that works for you? 

Regards,
Bharani, AdWords API Team

On Tuesday, November 14, 2017 at 5:05:21 AM UTC-5, harish....@latentview.com wrote:

harish....@latentview.com

unread,
Nov 21, 2017, 9:49:54 PM11/21/17
to AdWords API Forum
I get this error 'UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 52115: ordinal not in range(128)' when I execute the script with the query from the reference code.

Bharani Cherukuri (AdWords API Team)

unread,
Nov 22, 2017, 12:00:23 PM11/22/17
to AdWords API Forum
Hi Harish, 

Could you provide us the complete error logs and details about the library version used, so I can take a look and assist you further?

Regards,
Bharani, AdWords API Team

On Tuesday, November 14, 2017 at 5:05:21 AM UTC-5, harish....@latentview.com wrote:

harish....@latentview.com

unread,
Nov 27, 2017, 5:07:41 AM11/27/17
to AdWords API Forum
Thanks Bharani. I fixed it.

I need some help with the below script.  I want to know if i can write the where clause from the below script as  .Where ('AdType').In('EXPANDED_TEXT_AD') and ('AdNetworkType1').In('SEARCH')

report_query = (adwords.ReportQueryBuilder()
                  .Select('AdType','AdNetworkType1','AdNetworkType2,''AccountDescriptiveName',)
                  .From('AD_PERFORMANCE_REPORT')
                  .Where ('AdType').In('EXPANDED_TEXT_AD')
                  .Where ('AdNetworkType1').In('SEARCH')
                  .During('TODAY')
                  .Build())

Thanks!

Bharani Cherukuri (AdWords API Team)

unread,
Nov 27, 2017, 3:13:59 PM11/27/17
to AdWords API Forum
Hi Harish, 

I'm glad that you were able to resolve the script issue. As for your concern, it is recommended to use the second query to pull the Ad Performance metrics. Please refer to our code samples here for more information. 

Regards,
Bharani, AdWords API Team

On Tuesday, November 14, 2017 at 5:05:21 AM UTC-5, harish....@latentview.com wrote:

harish....@latentview.com

unread,
Nov 29, 2017, 1:38:11 AM11/29/17
to AdWords API Forum
Second query as in a separate where clause for another condition? like the below?


report_query = (adwords.ReportQueryBuilder()
                  .Select('AdType','AdNetworkType1','AdNetworkType2,''AccountDescriptiveName',)
                  .From('AD_PERFORMANCE_REPORT')
                  .Where ('AdType').In('EXPANDED_TEXT_AD')
                  .Where ('AdNetworkType1').In('SEARCH')
                  .During('TODAY')
                  .Build())

Thanks!

Bharani Cherukuri (AdWords API Team)

unread,
Nov 29, 2017, 1:05:06 PM11/29/17
to AdWords API Forum
Hello Harish, 

That's right, you will be able to use this query with another WHERE clause. We were able to test this and download the reports. If you run into any issues with this report query, please provide us the complete SOAP request and response logs, so I can take a look. Please use Reply privately to author to provide the logs. 

Regards,
Bharani, AdWords API Team

On Tuesday, November 14, 2017 at 5:05:21 AM UTC-5, harish....@latentview.com wrote:

harish....@latentview.com

unread,
Nov 30, 2017, 1:16:42 AM11/30/17
to AdWords API Forum
Ya Bharani. It worked for me as well. Thanks!
I am not a very skilled tech person, so I do not know understand what 'SOAP request and response logs' are. Could you please explain it at your convenience? Thanks!

Regarding DURING clause:
How do I download the report for difference date range. Example:
Oct 1, 2017 to Oct 20, 2017 (exclude October 4 -9) . Is it even possible? If yes, could you please rewrite the below script and send?
report_query = (adwords.ReportQueryBuilder()
                  .Select('AdType','AdNetworkType1','AdNetworkType2,''AccountDescriptiveName',)
                  .From('AD_PERFORMANCE_REPORT')
                  .Where ('AdType').In('EXPANDED_TEXT_AD')
                  .Where ('AdNetworkType1').In('SEARCH')
                  .During('TODAY')
                  .Build())

I make use of the below table for DURING clause. 
DateRangeLiteral -> TODAY | YESTERDAY | LAST_7_DAYS | THIS_WEEK_SUN_TODAY | THIS_WEEK_MON_TODAY | LAST_WEEK |
                    LAST_14_DAYS
| LAST_30_DAYS | LAST_BUSINESS_WEEK | LAST_WEEK_SUN_SAT | THIS_MONTH
Date             -> 8-digit integer: YYYYMMDD

harish....@latentview.com

unread,
Nov 30, 2017, 4:43:12 AM11/30/17
to AdWords API Forum
In addition to the above question, I would like to know what OPERATORS can replace 'In' in the below code (highlighted).

report_query = (adwords.ReportQueryBuilder()
                  .Select('AdType','AdNetworkType1','AdNetworkType2,''AccountDescriptiveName',)
                  .From('AD_PERFORMANCE_REPORT')
                  .Where ('AdType').In('EXPANDED_TEXT_AD')
                  .Where ('AdNetworkType1').In('SEARCH')
                  .During('TODAY')
                  .Build())

Bharani Cherukuri (AdWords API Team)

unread,
Nov 30, 2017, 9:48:26 AM11/30/17
to AdWords API Forum
Hello Harish, 

You may refer to the Python Where Builder class which lists all the supported predicates for the WHERE clause, when using the ReportQueryBuilder. Depending on the attribute in the WHERE clause, you will have to use one of the supported types to obtain the results. You can also take a look at our Reporting guide for more information. 

Regards,
Bharani, AdWords API Team

On Tuesday, November 14, 2017 at 5:05:21 AM UTC-5, harish....@latentview.com wrote:

harish....@latentview.com

unread,
Dec 1, 2017, 1:09:42 AM12/1/17
to AdWords API Forum
Please help me with this as well! 

I am not a very skilled tech person, so I do not know understand what 'SOAP request and response logs' are. Could you please explain it at your convenience? Thanks!

Regarding DURING clause:
How do I download the report for difference date range. Example:
Oct 1, 2017 to Oct 20, 2017 (exclude October 4 -9) . Is it even possible? If yes, could you please rewrite the below script and send?
report_query = (adwords.ReportQueryBuilder()
                  .Select('AdType','AdNetworkType1','AdNetworkType2,''AccountDescriptiveName',)
                  .From('AD_PERFORMANCE_REPORT')
                  .Where ('AdType').In('EXPANDED_TEXT_AD')
                  .Where ('AdNetworkType1').In('SEARCH')
                  .During('TODAY')
                  .Build())

I make use of the below table for DURING clause. 
DateRangeLiteral -> TODAY | YESTERDAY | LAST_7_DAYS | THIS_WEEK_SUN_TODAY | THIS_WEEK_MON_TODAY | LAST_WEEK |
                    LAST_14_DAYS | LAST_30_DAYS | LAST_BUSINESS_WEEK | LAST_WEEK_SUN_SAT | THIS_MONTH
Date             -> 8-digit integer: YYYYMMDD


On Thursday, 30 November 2017 11:46:42 UTC+5:30, harish....@latentview.com wrote:

Bharani Cherukuri (AdWords API Team)

unread,
Dec 1, 2017, 10:30:44 AM12/1/17
to AdWords API Forum
Hello Harish, 

Please find my detailed response below:

SOAP logs are the actual API request and response log in the XML format. These logs help to troubleshoot the error and fix the issue. You may refer to our troubleshooting guide for more information. You could also enable SOAP logging for the Python client library by following the steps mentioned in this guide.

As for your second concern, you may refer to this guide which lists all the supported predicates for DURING clause. For this use case, you will have to run two reports separately specifying the two dateRanges as:
  • First report with .During(start_date=20171001, end_date=20171004)
  • Second Report with .During(start_date=20171009, end_date=20171031)
Then you can accumulate results of both the reports for this specific dateRange to obtain the desired results. Let me know if you have any other questions. 

harish....@latentview.com

unread,
Feb 15, 2018, 12:42:10 AM2/15/18
to AdWords API Forum
Hello Bharani,
 
Thanks for all the help!

I have a name.py file which is a basic adwords api script to download adgroup performance data. I want to know if there is a way to directly add the information from credentials.yaml in name.py itself instead of using path in adwords.AdWordsClient.LoadFromStorage(path).Thanks!

Bharani Cherukuri (AdWords API Team)

unread,
Feb 15, 2018, 12:00:40 PM2/15/18
to AdWords API Forum
Hello Harish, 

It is only possible to send the client customer Id at the runtime in the python file. You may refer to this guide on how to do so. On the other hand, it is not possible to pass all the credentials mentioned in the googleads.yaml file to the python file. You will be able to cache the authentication information. The library's LoadFromStorage methods default to looking for a file with this name in your home directory, but you can pass in a path to any file with the correct yaml contents. Let me know if you have any other questions. 

harish....@latentview.com

unread,
Mar 21, 2018, 1:38:08 AM3/21/18
to AdWords API Forum
Thank Bharani,

Using AdWords UI I'm able to segment ads by keyword/placement, but I do not see keyword/placement segment in ad performance report. Is there a way to do this using API? Thanks

Vincent Racaza (AdWords API Team)

unread,
Mar 21, 2018, 3:03:26 AM3/21/18
to AdWords API Forum
Hi,

I am a teammate of Bharani and will provide support to you as she is OOO.

Yes, the "Keyword/Placement" segment is available in the old AdWords UI view for the ads level report. However, for the AdWords API, this segment is currently not supported. You can only segment by CriterionId (will return any criteria that triggered the ad), however, adding this field will require you to set the includeZeroImpressions=false since this field does not support zero impressions

Furthermore, if you have other clarifications, I suggest to create a new forum thread so we can better track your new concern.

Thanks,
Vincent
AdWords API Team

harish....@latentview.com

unread,
Mar 21, 2018, 6:50:12 AM3/21/18
to AdWords API Forum
Sorry I did not look at CriterionId.. Thanks a lot Vincent!
Reply all
Reply to author
Forward
0 new messages