[PHP] Datas duplicadas

25 views
Skip to first unread message

Desenvolvimento - Grupo Lead Negócios Inteligentes

unread,
Mar 18, 2015, 8:33:44 PM3/18/15
to adwor...@googlegroups.com
Olá pessoal,

Estou com uma dúvida: Quero buscar dados com 0 Impressões e o dia da semana, porém o que é retornado é isso abaixo. A data vem duplicada, só que com o dia da semana diferente, o que pode estar acontecendo?

{"@attributes":{"dayOfWeek":"Tuesday","day":"2015-03-07","avgPosition":"0.0","ctr":"0.00%","convRate":"0.00%","convertedClicks":"0","clicks":"0","impressions":"0"}},{"@attributes":{"dayOfWeek":"Wednesday","day":"2015-03-07","avgPosition":"0.0","ctr":"0.00%","convRate":"0.00%","convertedClicks":"0","clicks":"0","impressions":"0"}},

Desde já agradeço a resposta! 

Josh Radcliff (AdWords API Team)

unread,
Mar 18, 2015, 10:37:47 PM3/18/15
to adwor...@googlegroups.com
Hi,

Sorry, but I can only answer in English. The DayOfWeek value is the day of the week of each impression, so if you have zero impressions then AdWords will usually exclude zero impression rows on any report that requests DayOfWeek. Could you describe your use case a bit more? Why do you want DayOfWeek and zero impression rows?

Also, could you send over your report request (with any sensitive information removed) and campaign ID? I'd like to see which report is returning zero impression rows with DayOfWeek, since that's a Segment field, and Segment fields usually cause exclusion of zero impression rows.

Thanks,
Josh, AdWords API Team

Desenvolvimento - Grupo Lead Negócios Inteligentes

unread,
Mar 19, 2015, 1:15:12 PM3/19/15
to adwor...@googlegroups.com
Bom dia galera,

Esse é meu script:

ID da Campanha: 281-396-0359


$user = new AdWordsUser();
    $user
->SetClientCustomerId($id);
    $user
->LogDefaults();
    $user
->LoadService('ReportDefinitionService', 'v201409');

    $selector
= new Selector();
    $selector
->fields = array('DayOfWeek', 'Date', 'AveragePosition', 'Ctr', 'ConversionRateManyPerClick', 'Conversions', 'Clicks', 'Impressions');

   
if ($display != "s") {
      $selector
->predicates[] = new Predicate('AdNetworkType1', 'IN', array('SEARCH'));
   
}

    $reportDefinition
= new ReportDefinition();
    $reportDefinition
->selector = $selector;
    $reportDefinition
->reportName = ' ';
    $reportDefinition
->dateRangeType = $data;
    $reportDefinition
->reportType = 'ACCOUNT_PERFORMANCE_REPORT';
    $reportDefinition
->downloadFormat = 'XML';
    $reportDefinition
->includeZeroImpressions = TRUE;

   
//$filePath = dirname(__FILE__) . '\report.XML';
    $filePath
= NULL;
    $report
= ReportUtils::DownloadReport($reportDefinition, $filePath, $user, $options = NULL);

    $xml
= new SimpleXMLElement($report);
    $rows
= $xml->xpath('/report/table/row');

    echo json_encode
($rows);


Quando jogo os dados no gráfico, ele ficam assim:




Obrigado Josh, pela resposta rápida.



Josh Radcliff (AdWords API Team)

unread,
Mar 19, 2015, 7:41:30 PM3/19/15
to adwor...@googlegroups.com
Hi,

Thanks for sending over your request. The behavior here is a bit strange -- usually, when you include any Segment field such as Date or DayOfWeek, zero impression rows are implicitly excluded.

In this case, the ACCOUNT_PERFORMANCE_REPORT is, for some reason, returning zero impression rows. If you want these rows to be excluded, change the includeZeroImpressions option to FALSE.

Thanks,
Josh, AdWords API Team

Desenvolvimento - Grupo Lead Negócios Inteligentes

unread,
Mar 19, 2015, 8:27:26 PM3/19/15
to adwor...@googlegroups.com
Obrigado pela resposta Josh,

O problema só acontece quando utilizo o "DayOfWeek", por que quando utilizo somente o "Date" ele funciona normalmente, ele não duplica nada. Veja abaixo: 

E, se possível, gostaria de ter as buscas contendo as zero impressões. Tem como obter?

Josh Radcliff (AdWords API Team)

unread,
Mar 20, 2015, 1:57:39 PM3/20/15
to adwor...@googlegroups.com
Hi,

Could you clarify what you mean by "duplicate"? Which fields specifically are you saying are duplicated in the report?

Thanks,
Josh, AdWords API Team

Desenvolvimento - Grupo Lead Negócios Inteligentes

unread,
Mar 20, 2015, 5:22:30 PM3/20/15
to adwor...@googlegroups.com
Good day Josh, 

I will try to explain better and in english using Google Translate, :D

Below are two screen shots with the problem that occurs when i use the script I sent to you in previous answers:


As you can see above, the dates are repeated with different days of the week. 

I wanted all this data: Zero Impressions, Day of the Week and Date in my chart, but it duplicates the dates.
An alternative is to seek data without duplicating or repeating dates?


Obrigado/Thanks josh

Josh Radcliff (AdWords API Team)

unread,
Mar 20, 2015, 5:36:08 PM3/20/15
to adwor...@googlegroups.com
Hi,

Thanks for sending the example - now I understand what you meant by duplicate rows.

I've filed an issue with the reporting team on the duplicate rows. I'll post back once I get an update from them.

However, as I mentioned earlier, the report should not be returning zero impression rows at all when you include either Date or DayOfWeek, so I recommend designing your system so that it does not expect zero impression rows, and then explicitly exclude them in your report definition. This will also eliminate the duplicates, since the duplicate rows all have Impressions = 0.

Thanks,
Josh, AdWords API Team

Desenvolvimento - Grupo Lead Negócios Inteligentes

unread,
Mar 20, 2015, 7:44:28 PM3/20/15
to adwor...@googlegroups.com
I understood, Josh.

I will rethink my system. 

Thank you Josh for the quickly answers. :D
Message has been deleted

Desenvolvimento - Grupo Lead Negócios Inteligentes

unread,
Mar 23, 2015, 12:02:26 PM3/23/15
to adwor...@googlegroups.com
Hello Josh, sorry come back that topic again, but I forgot to ask you something:

How AdWords can pull the date, day of week and zero impressions? Like the image below...


Josh Radcliff (AdWords API Team)

unread,
Mar 23, 2015, 12:37:01 PM3/23/15
to adwor...@googlegroups.com
Hi,

You cannot pull Date or other Segment fields and get zero impressions. When you include a Segment field, it implicitly excludes zero impression rows.

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages