How can i get total ads count using Campaign ID? Just Count.

21 views
Skip to first unread message

yogesh patel

unread,
Sep 9, 2019, 9:17:32 AM9/9/19
to AdWords API and Google Ads API Forum
Hello,

How can I get total ADS count using Campaign ID? I already did some code but it was taking too much time when I have multiple campaigns?


$selectorAds = new Selector();
                     $selectorAds->setFields(['Id']);
                        $selectorAds->setOrdering([new OrderBy('Id', SortOrder::ASCENDING)]);
                        $selectorAds->setPredicates(
                            [
                                new Predicate('CampaignId', PredicateOperator::IN, [$campaign->getId()]),
                                new Predicate('Status',PredicateOperator::IN,[AdGroupAdStatus::ENABLED])
                            ]
                        );
                        $pageAds = $adGroupAdService->get($selectorAds);
                        
                        // Print out some information for each ad group ad.
                        if ($pageAds->getEntries() !== null) {
                            $no_of_active_ads = $pageAds->getTotalNumEntries();
                            
                        }

Google Ads API Forum Advisor Prod

unread,
Sep 9, 2019, 5:07:20 PM9/9/19
to yogeshp...@gmail.com, adwor...@googlegroups.com

Hi Yogesh,

Thank you for reaching the support. You could use Ad Performance Report to get the list of the ads associated with a campaign based on the campaign id. Please find below the sample report query for reference.
SELECT Id, CampaignId FROM AD_PERFORMANCE_REPORT WHERE CampaignId IN ["2XXXXXXXX2", "20X26XXXX5"] AND Status IN ["ENABLED"]
Let us know if you need any additional information.

Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001UHG8ba:ref

yogesh patel

unread,
Sep 10, 2019, 1:50:13 AM9/10/19
to Google Ads API Forum Advisor Prod, adwor...@googlegroups.com
Hey,

I know that things.but i want to get the count of active ads using campaign id?
--
Assuring Best Service,
Regards,
Web-Developer ,
Yogesh Patel,
8866330189.
Reply all
Reply to author
Forward
0 new messages