AWQL result has duplicates

292 views
Skip to first unread message

Tim Johnson

unread,
Sep 6, 2017, 4:13:57 AM9/6/17
to AdWords API Forum
Hi, I am trying to pull unique Account,Campaign Name, & Campaign ID's using AWQL using PHP.  Here's the reporting part of my code:

    $reportQuery = 'SELECT AccountDescriptiveName,CampaignName,CampaignId FROM ADGROUP_PERFORMANCE_REPORT';
    $reportDownloader = new ReportDownloader($session);
    $reportSettingsOverride = (new ReportSettingsBuilder())
        ->includeZeroImpressions(false)
        ->skipReportHeader(TRUE)
		->skipColumnHeader(FALSE)
		->skipReportSummary(TRUE)
		->SkipReportHeader(TRUE)
		->build();
    $reportDownloadResult = $reportDownloader->downloadReportWithAwql($reportQuery, DownloadFormat::CSV, $reportSettingsOverride);
    $a =  $reportDownloadResult->getAsString();


And this is the output:

[2017-09-06 08:11:06] AW_REPORT_DOWNLOADER.INFO: clientCustomerId=509-496-9641 unknown (AwApi-PHP, googleads-php-lib/29.0.0, PHP/7.1.2, GuzzleHttp/6.2.1, curl/7.51.0) "POST /api/adwords/reportdownload/v201708 HTTP/1.1" Status: 200
Account,Campaign,Campaign ID
Account #1,Campaign #2,921452568
Account #1,Campaign #2,921452568
Account #1,Campaign #1,912412908
Account #1,Campaign #1,912412908 

As you can see the result is duplicated.  How do I only get back distinct rows?

Thank you very much for the help.

Regards
Tim

Shwetha Vastrad (AdWords API Team)

unread,
Sep 6, 2017, 10:34:21 AM9/6/17
to adwor...@googlegroups.com
Hi Tim,

I see that you are retrieving an AdGroup Performance Report, which aggregates performance statistics at the AdGroup level, one row per AdGroup. Since both these campaigns have 2 AdGroups, you are getting 4 rows, 1 for each AdGroup. To get statistics aggregated at the Campaign level, you need to use Campaign Performance Report

Regards,
Shwetha, AdWords API Team.
Message has been deleted

Tim Johnson

unread,
Sep 6, 2017, 11:29:20 PM9/6/17
to AdWords API Forum
Hi Shwetha,

Thanks for that- that's very logical.

Quick follow up, do you know how to ensure that this area:

[2017-09-06 08:11:06] AW_REPORT_DOWNLOADER.INFO: clientCustomerId=509-496-9641 unknown (AwApi-PHP, googleads-php-lib/29.0.0, PHP/7.1.2, GuzzleHttp/6.2.1, curl/7.51.0) "POST /api/adwords/reportdownload/v201708 HTTP/1.1" Status: 200

is not printed?

Cheers,
Greg

Shwetha Vastrad (AdWords API Team)

unread,
Sep 7, 2017, 10:10:15 AM9/7/17
to AdWords API Forum
Hi, 

You need to change the logging level as described here to suppress logger messages as required. 
Reply all
Reply to author
Forward
0 new messages