Problems getting information atributte average_cpc - Get Keyword idea class

26 views
Skip to first unread message

Javier Martinez

unread,
Mar 14, 2017, 2:15:17 PM3/14/17
to AdWords API Forum
I have a problem getting averge_CPC attribute with Get keyword Ideas class.

For each suggested keyword I try to request average_CPC. Result is an three arguments object. I only need microAmount value. Then I want to save it on other variable but I can,t. Log tells to me that I can't access to protected object. What can I do?

PHPexample
$average_cpc =
             
($data[AttributeType::SEARCH_VOLUME]->getValue() !== null)
             
? $data[AttributeType::SEARCH_VOLUME]->getValue() : 0;

$cpc_suggested = $average_cpc->microAmount;

Regards


Shwetha Vastrad (AdWords API Team)

unread,
Mar 14, 2017, 2:46:11 PM3/14/17
to AdWords API Forum
Hi Javier,

Could you try the following to get the average CPC? 

$average_cpc =
($data[AttributeType::AVERAGE_CPC]->getValue() !== null)
? $data[AttributeType::AVERAGE_CPC]->getValue() : 0;

The resulting attribute is a MoneyAttribute and you can retrieve the microAmount from this attribute. 

Regards,
Shwetha, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages