Cannot reach QualityScore using getQualityInfo()

56 views
Skip to first unread message

Minas Gratas

unread,
Jan 24, 2017, 8:16:28 AM1/24/17
to AdWords API Forum
Hello I am using GetKeywords example from the library (v201609).I can get the keywords but I cannot get the quality

          printf(
              "Keyword with text '%s', match type '%s', criteria type '%s', "
                  . "and ID %d was found.\n",
              $adGroupCriterion->getCriterion()->getText(),
              $adGroupCriterion->getCriterion()->getMatchType(),
              $adGroupCriterion->getCriterion()->getType(),
              $adGroupCriterion->getCriterion()->getId(),
              $adGroupCriterion->getQualityInfo()
          );

getQualityInfo is returning an Array
protected 'qualityScore'

but could not figure out how to get the data.

If I use
          printf(
              "Keyword with text '%s', match type '%s', criteria type '%s', "
                  . "and ID %d was found.\n",
              $adGroupCriterion->getCriterion()->getText(),
              $adGroupCriterion->getCriterion()->getMatchType(),
              $adGroupCriterion->getCriterion()->getType(),
              $adGroupCriterion->getCriterion()->getId(),
              $adGroupCriterion->getQualityInfo()->getQualityScore()
          );

Then I am getting the following error;

Fatal error: Call to a member function getQualityScore() on null

Can you point me the right direction please?


Vishal Vinayak (Adwords API Team)

unread,
Jan 24, 2017, 12:53:03 PM1/24/17
to AdWords API Forum
Hi Minas,

As mentioned in the reference tutorial for AdGroupCriterionService.QualityInfo, qualityScore may be returned as null if AdWords is unable to determine this information. Could you please try downloading the Criteria Performance Report and check what you see in the QualityScore field of the report, for the same Criterion ID as the one that returns null qualityScore using AdGroupAdService?

Regards,
Vishal, AdWords API Team

Minas Gratas

unread,
Jan 24, 2017, 3:09:37 PM1/24/17
to AdWords API Forum
Vishal thanks for your reply.

Well,  actually I found the source of the problem with help :) When a keywords have a Null  QS then I am having this issue.
The reports are great but its a bit over kill for me because I just want to get the QS. I do not want to find a workaround to get the data from the report and than scrape the QS data from excel or csv. I would love to use reports only if they would hand me the data as an object. 

Can I have the report output as an object (not as a pre-prepared file)? If not then I will find a way to check QS, if its Null than I'll set it to 0.

Vishal Vinayak (Adwords API Team)

unread,
Jan 24, 2017, 4:23:08 PM1/24/17
to AdWords API Forum
Hi Minas,

Some of the other AdWords API client libraries (such as Java) let you stream the output of a report, which can then be converted to an object manually based on the fields in the selector. Unfortunately, PHP client library does not support streaming of reports.  
Reply all
Reply to author
Forward
0 new messages