Just get error,  

*Uncaught Error: Call to a member function getValue()*

Why *getAverageCpv() *is not working. 

My campaign has averge cpv, not null.



public static function runExample(GoogleAdsClient $googleAdsClient, 
$customerId)
    {
        $googleAdsServiceClient = 
$googleAdsClient->getGoogleAdsServiceClient();
        // Creates a query that retrieves all keyword statistics.
        $query =
            "SELECT campaign.id, campaign.name, campaign.status, 
segments.device, metrics.impressions,
       metrics.clicks, metrics.ctr, metrics.average_cpv, 
metrics.average_cpc, metrics.cost_micros
FROM campaign
WHERE segments.date DURING YESTERDAY";
        // Issues a search request by specifying page size.
        $response =
            $googleAdsServiceClient->search($customerId, $query, 
['pageSize' => self::PAGE_SIZE]);

        // Iterates over all rows in all pages and prints the requested 
field values for
        // the keyword in each row.
        foreach ($response->iterateAllElements() as $googleAdsRow) {
            /** @var GoogleAdsRow $googleAdsRow */
            $campaign = $googleAdsRow->getCampaign();
$metrics = $googleAdsRow->getMetrics();
            
printf(
                "campaign name '%s' "
                . "ID %d "
. "cpv %s "
. "cost %s "
. "%s",
                $campaign->getName()->getValue(),
                $campaign->getId()->getValue(),
*$metrics->getAverageCpv()->getValue(),*
$metrics->getCostMicros()->getValue(),
                PHP_EOL
            );

        }
    }

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/3d66cea4-46fd-4402-9120-92ae444650f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to