I'm trying to get the network type and device type from segments
 $query = 'SELECT
 campaign.id, 
ad_group.id,metrics.clicks,metrics.ctr,metrics.impressions,segments.ad_network_type,segments.device,
 ad_group.name 
FROM ad_group';
        
        if ($campaignId !== null) {
            $query .= " WHERE campaign.id = $campaignId";
        }

        // 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 ad group in each row.
        foreach ($response->iterateAllElements() as $googleAdsRow) {
            /** @var GoogleAdsRow $googleAdsRow */
            printf(
                
"Ad group with ID %d Clicks %d Impressions %d CTR %d and name '%s' was found in 
campaign with ID %d and device '%s' network type '%s'.%s"
,
                $googleAdsRow->getAdGroup()->getId()->getValue(),
                $googleAdsRow->getMetrics()->getClicksUnwrapped(),
                $googleAdsRow->getMetrics()->getImpressionsUnwrapped(),
                $googleAdsRow->getMetrics()->getCtrUnwrapped(),
                $googleAdsRow->getAdGroup()->getName()->getValue(),
                $googleAdsRow->getCampaign()->getId()->getValue(),
                $googleAdsRow->getSegments()->getDevice(),
                $googleAdsRow->getSegments()->getAdnetworktype(),
                
                PHP_EOL
            );
        }
But i'm getting Numerical values like 1,2,3,4
Ad group with ID 77778102923 Clicks 0 Impressions 205 CTR 0 and name 'A - 
Videography' was found in campaign with ID 6501346749 and device '4' 
network type '3'.
Ad group with ID 77778102923 Clicks 2 Impressions 255 CTR 0 and name 'A - 
Videography' was found in campaign with ID 6501346749 and device '2' 
network type '3'.
Ad group with ID 98328817814 Clicks 1 Impressions 882 CTR 0 and name 
'Remarketing' was found in campaign with ID 9715050198 and device 
'4' network type '4'.
Ad group with ID 98328817814 Clicks 2 Impressions 559 CTR 0 and name 
'Remarketing' was found in campaign with ID 9715050198 and device 
'2' network type '4'.
Ad group with ID 98328817814 Clicks 0 Impressions 7 CTR 0 and name 
'Remarketing' was found in campaign with ID 9715050198 and device '3' 
network type '4'

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/7a4c388c-2f94-476f-8fce-6ccc3b47837f%40googlegroups.com.

Reply via email to