campaign id, name and adgroup id, name in ads list

33 views
Skip to first unread message

denma test

unread,
Aug 10, 2020, 8:41:25 AM8/10/20
to AdWords API and Google Ads API Forum
Hi
Have taken Ads list using selectors as like in below code, $session = self::setSession();
        $adWordsServices = new AdWordsServices();
        $adService = $adWordsServices->get($session, AdService::class);
        $adGroupAdService = $adWordsServices->get($session, AdGroupAdService::class);
        // $AdId = intval($AdId);
        $adData = array();
           $selector = new Selector();
        $selectors = array('Id','BaseCampaignId','AdType','MultiAssetResponsiveDisplayAdMarketingImages', 'MultiAssetResponsiveDisplayAdSquareMarketingImages', 'MultiAssetResponsiveDisplayAdLandscapeLogoImages', 'MultiAssetResponsiveDisplayAdLogoImages', 'MultiAssetResponsiveDisplayAdHeadlines','MultiAssetResponsiveDisplayAdLongHeadline', 'MultiAssetResponsiveDisplayAdBusinessName',
                    'MultiAssetResponsiveDisplayAdDescriptions', 'DisplayUrl','CreativeFinalUrls','CreativeFinalUrlSuffix','MultiAssetResponsiveDisplayAdCallToActionText');
       $selector->setFields($selectors);
            $result = $adGroupAdService->get($selector);
But it is not return Campaign name, Adgroup name, i van get it by calling particular service since am getting id in current list. Is there any other easy way to get it? i just want to minimize API hit.

Google Ads API Forum Advisor Prod

unread,
Aug 10, 2020, 12:07:27 PM8/10/20
to denm...@gmail.com, adwor...@googlegroups.com
Hello,

When selecting your AdGroupAd, you can select the fields baseCampaignId and baseAdGroupId to get info on your ads' campaigns and ad groups.

Regards,
Anthony
Google Ads API Team

ref:_00D1U1174p._5004Q23Ivg9:ref

denma test

unread,
Aug 11, 2020, 12:53:18 AM8/11/20
to AdWords API and Google Ads API Forum
HI Anthony,
You meant, we need to hit additional API calls to fetch Campaign, Adgroup data using baseCampaignId and baseAdGroupId? If yes we will get multiple creatives with one campaign and adgroups we cannot hip additional API to fetch details in for loop. I just wanted to get it from the Adwordsserivce API call as sent before. Please correct me if am in wrong way.

Google Ads API Forum Advisor Prod

unread,
Aug 11, 2020, 1:02:11 PM8/11/20
to denm...@gmail.com, adwor...@googlegroups.com
Hello,

If you include baseCampaignId and baseAdGroupId in your selector while using AdGroupAdService, you will see these ids returned for your ads.

denma test

unread,
Aug 12, 2020, 12:50:14 AM8/12/20
to AdWords API and Google Ads API Forum
Hello Anthony,
Yes i knew it, but my actual need is names of campaign and Adgroup in list.

Google Ads API Forum Advisor Prod

unread,
Aug 12, 2020, 2:57:24 PM8/12/20
to denm...@gmail.com, adwor...@googlegroups.com
Hi,

Unfortunately, the names are not available for the AdGroupAdService. The best workaround to get all the details you need is to run the Ad Performance Report.

denma test

unread,
Aug 13, 2020, 12:59:43 AM8/13/20
to AdWords API and Google Ads API Forum
Thanks have done with Ad Performance Report, thanks.
Reply all
Reply to author
Forward
0 new messages