Hi Team,

I need to fetch campaign details from Campaign IDs and what will be best to 
do this, right now I using the following code

$selector->setFields(
        [
            'CampaignId',
            'AdGroupId',
            'Id',
            'Criteria',
            'CriteriaType',
            'Impressions',
            'Clicks',
            'Cost',
            'AverageCpc',
            'Conversions',
            'Ctr',
            'ConversionRate'
        ]
    );

if(!empty($campaignId)){
        $selector->setPredicates(
            [
                new Predicate('CampaignId', PredicateOperator::IN, 
[$campaignId])
            ]
        );
    }

$reportDefinition = new ReportDefinition();
    $reportDefinition->setSelector($selector);
    $reportDefinition->setReportName(
        'Campaign performance report #' . uniqid()
    );
    $reportDefinition->setDateRangeType(
        ReportDefinitionDateRangeType::LAST_7_DAYS
    );
    $reportDefinition->setReportType(
        ReportDefinitionReportType::CRITERIA_PERFORMANCE_REPORT
    );
    $reportDefinition->setDownloadFormat(DownloadFormat::CSVFOREXCEL);

    // Download report.
    $reportDownloader = new ReportDownloader($session);
    $reportSettingsOverride = (new 
ReportSettingsBuilder())->includeZeroImpressions(true)->build();
    $reportDownloadResult = $reportDownloader->downloadReport(
        $reportDefinition,
        $reportSettingsOverride
    );
    $result = $reportDownloadResult->getAsString();



but it prints as like CSV format, not as an array. 

Thanks in advance. 

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"AdWords API and Google Ads 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/aa2649e3-6a0e-4313-90d5-c858c72950fd%40googlegroups.com.

Reply via email to