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.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/71d5eaad-94c5-4539-9fee-055f8d537f0bn%40googlegroups.com.

Reply via email to