Import Data from "Where Ads are Showed" using API

41 views
Skip to first unread message

Mihai Cucui

unread,
Jul 31, 2023, 8:37:42 AM7/31/23
to Google Ads API and AdWords API Forum
Hello,

I am trying to import the YouTube placement costs. For this I need the information from Content -> Where Ads are Showed tab.

To compute the total YouTube placements cost I think I need to add the cost computed when I apply "Network: YouTube" filter with the cost computed when I apply "Network: Display" & "Placement contains youtube.com" filters.

But, when I try to do it using Google Ads API(V12) I get a cost that is equal with the cost computed when I apply "Network: Youtube" filter. I think the api query somehow misses the cost of the placements from "Network: Display" & "Placement contains youtube.com" filters.

Here is my query and filtering in php:

$query = "SELECT detail_placement_view.group_placement_target_url, detail_placement_view.placement, detail_placement_view.target_url, segments.ad_network_type, metrics.cost_micros FROM detail_placement_view WHERE segments.date >= '2023-07-07' AND segments.date < '2023-07-08'";
$stream = $adsServiceClient->searchStream(strval($clientId), $query);
foreach ($stream->iterateAllElements() as $element){
if(str_contains($element->getDetailPlacementView()->getGroupPlacementTargetUrl(), 'youtube.com')
|| str_contains($element->getDetailPlacementView()->getPlacement(), 'youtube.com')
|| in_array($element->getSegments()->getAdNetworkType(), [6, 7])
) {
$collector += $element->getMetrics()->getCostMicros()/1000000;
}
}

More exactly I am trying to filter the data that contains youtube or has youtube related AdNetwork Types.

I am trying to figure out what I am doing wrong.

Google Ads API Forum Advisor

unread,
Jul 31, 2023, 2:12:38 PM7/31/23
to mihai...@digitaldistribution.io, adwor...@googlegroups.com

Hi Mihai,

Thank you for contacting the Google Ads API team.

In order for us to better investigate and assist you with your concern, can you please provide the complete request and response logs with request-id along with some screenshots of the data you would like to retrieve via API. You may send these to us via Reply privately to author option.

For the client libraries, instructions on configuring logging can be found by navigating to the Client libraries > Your client library (ex Java) > Logging documentation, which you can access from this link: https://developers.google.com/google-ads/api/docs/client-libs. For REST interface requests, you can enable logging via the curl command by using the -i flag. This will cause the tool to include the HTTP response headers in the output.

Reference links:
request - https://developers.google.com/google-ads/api/docs/concepts/field-service#request
response - https://developers.google.com/google-ads/api/docs/concepts/field-service#response
request-id - https://developers.google.com/google-ads/api/docs/concepts/call-structure#request-id

This message is in relation to case "ref:_00D1U1174p._5004Q2nZIuP:ref"

Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages