shopping_performance_view getSegments()

179 views
Skip to first unread message

John

unread,
Jan 12, 2022, 1:31:23 PM1/12/22
to Google Ads API and AdWords API Forum
Hi,

I'm trying to get the shopping_performance_view report to return the same data that I used to get with the SHOPPING_PERFORMANCE_REPORT in the old API but I'm not able to have getSegments() return anything for extracting the product_item_id

I'm passing the following query

SELECT campaign.id, metrics.clicks, metrics.cost_micros, segments.product_item_id, metrics.conversions, metrics.impressions, metrics.search_impression_share, metrics.conversions_value FROM shopping_performance_view WHERE segments.date BETWEEN '20211212' AND '20220111'

In this example $segments return null whereas $metrics returns all the methods I need to extract data from it. 

foreach ($stream->iterateAllElements() as $googleAdsRow) {
        $metrics = $googleAdsRow->getMetrics();                
        $segments = $googleAdsRow->getSegments();
}

I assume I'm missing something obvious. Can someone please point me in the right direction so that I can get the product_item_id along with all the associated metrics?

Thanks,

Google Ads API Forum Advisor

unread,
Jan 12, 2022, 10:11:14 PM1/12/22
to john...@shoptimised.com, adwor...@googlegroups.com
Hi John,

Thank you for reaching out to our API support team.

So our team can take a closer look, could you also share the generated and complete request and response logs, with the request-id and login-customer-id? This is so that our team can replicate your report on our end and check whether there are indeed values being returned, and if this could also possibly be a client library related issue.

If you haven't yet, logging can be enabled by navigating to the Client libraries > Your client library (ex. Java) > Logging documentation, which you can access from this link. If it is PHP you are using, you can refer directly to this PHP logging guide.

You may then send the requested information via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2UjNCA:ref

John

unread,
Jan 13, 2022, 8:15:32 AM1/13/22
to Google Ads API and AdWords API Forum
Thanks for the response.

I figured out where I was going wrong. 

The first row returned didn't have an item id so there were no segments available. I incorrectly assumed that this would be the case for all returned rows but as it turns out every other row does allow me to extract the segments and retrieve the item id. 

I'm not sure how a shopping click isn't being associated with a product id but never mind. Now that i know, I can work around it.

Cheers.

Reply all
Reply to author
Forward
0 new messages