Re: [PHP] Como filtrar somente resultados Rede de Pesquisa?

37 views
Skip to first unread message
Message has been deleted

Josh Radcliff (AdWords API Team)

unread,
Jan 28, 2015, 5:46:37 PM1/28/15
to adwor...@googlegroups.com
Hi,

The predicate you commented out should filter to only your Search campaigns.

// Filter out deleted criteria.
//$selector->predicates[] = new Predicate('AdvertisingChannelType', 'IN', array('SEARCH'));

If you uncomment that line, does the report fail, or does it return non-search campaigns?

Thanks,
Josh, AdWords API Team

On Wednesday, January 28, 2015 at 12:17:01 PM UTC-5, Desenvolvimento - Grupo Lead Negócios Inteligentes wrote:
Pessoal, queria saber como filtrar somente resultados Rede de Pesquisa e não vir junto de a de Display?
Estou tentando a um tempo, só que não consigo.
Já tentei usar esse predicado: AdvertisingChannelType, Porém não consegui. Segue o código abaixo:

<?php
error_reporting(-1);
ini_set('display_errors',1);
$path = dirname(__FILE__) . '/../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

require_once '/Google/Api/Ads/AdWords/Lib/AdWordsUser.php';

$user = new AdWordsUser();

$user->SetClientCustomerId('849-948-1308');

// Log SOAP XML request and response.
$user->LogDefaults();

$user->LoadService('ReportDefinitionService', 'v201409');
$LoadService = $user->LoadService('ReportDefinitionService', 'v201409');

// Create selector.
$selector = new Selector();
$selector->fields = array('AdNetworkType1', 'CampaignId', 'Impressions', 'Clicks', 'Conversions', 'Ctr', 'AveragePosition');



// Filter out deleted criteria.
//$selector->predicates[] = new Predicate('AdvertisingChannelType', 'IN', array('SEARCH'));



// Create report definition.
$reportDefinition = new ReportDefinition();
$reportDefinition->selector = $selector;
$reportDefinition->reportName = ' ';
$reportDefinition->reportName = 'Campaign performance report #' . uniqid();
$reportDefinition->dateRangeType = 'ALL_TIME';
$reportDefinition->reportType = 'CAMPAIGN_PERFORMANCE_REPORT';
$reportDefinition->downloadFormat = 'CSV'; //CSVFOREXCEL

// Exclude criteria that haven't recieved any impressions over the date range.
$reportDefinition->includeZeroImpressions = FALSE;

// Set additional options.
$options = array('version' => 'v201409', 'returnMoneyInMicros' => TRUE);

$filePath = NULL;
$report = ReportUtils::DownloadReport($reportDefinition, $filePath, $user, $options = NULL);
printf("Report  contents are \n %s", $report);

?>


Desenvolvimento - Grupo Lead Negócios Inteligentes

unread,
Jan 29, 2015, 6:23:28 AM1/29/15
to adwor...@googlegroups.com
Olá Josh,

Quando eu descomento a linha, o script retorna isso:

Report contents are (All Time) Network,Impressions,Clicks,Converted clicks,CTR,Avg. position Display Network,91888,215,0,0.23%,1.4 Search Network,2648,186,7,7.02%,1.5 Total, --,94536,401,7,0.42%,1.4

Eu queria que retornasse só Search Network.

Josh Radcliff (AdWords API Team)

unread,
Jan 29, 2015, 9:32:48 AM1/29/15
to adwor...@googlegroups.com
Hi,

You are filtering by AdvertisingChannelType, but the Display Network value is from the AdNetworkType1 field. If you include the AdvertisingChannelType field in your list of fields, you'll see that the predicate is working as expected.

The reason you get some rows with AdNetworkType1 = Display Network is that campaign ID 231914938 was changed from a Search Network with Display Select campaign to a Search Network Only campaign on January 19.

The AdNetworkType1 field is a Segment field, meaning it shows the value of that field at the time of each impression (see the notes on the Behavior field under the list of reports here). The AdvertisingChannelType field is an Attribute, which means it only shows the current value of that field. If you add the Date field to your report, you'll see that all of the AdNetworkType1 = Display Network rows are from January 19th or earlier since up until the 19th, the campaign was serving ads on the Display Network.

Cheers,
Josh, AdWords API Team

Desenvolvimento - Grupo Lead Negócios Inteligentes

unread,
Jan 29, 2015, 12:20:37 PM1/29/15
to adwor...@googlegroups.com
Entendi e consertei Josh, porém ele retorna o Total de todas as campanhas, há alguma forma de conseguir somente os dados da Rede de Pesquisa, como mostrado na imagem abaixo?

Thanks again! :D

Josh Radcliff (AdWords API Team)

unread,
Jan 29, 2015, 2:42:18 PM1/29/15
to adwor...@googlegroups.com
Hi,

The CAMPAIGN_PERFORMANCE_REPORT will always return at least one row per campaign. You can either calculate the totals yourself when processing the report, or use the ACCOUNT_PERFORMANCE_REPORT to get one row per AdNetworkType1.

Thanks,
Josh, AdWords API Team

Desenvolvimento - Grupo Lead Negócios Inteligentes

unread,
Feb 2, 2015, 7:05:27 AM2/2/15
to adwor...@googlegroups.com
Obrigado Josh, obrigado mesmo. Consegui fazer o que estava tentando.

Reply all
Reply to author
Forward
0 new messages