dtslobe4694 2019-05-11 21:22
浏览 51

获取多个广告系列统计信息google广告

I'm trying to get a Google Ads report but I'm having problems and I need help.

Currently I can get data at the level of ACCOUNT (on a date appears a grouped data) or CAMPAIGN (for each date appears each value for each separate campaign).

I need the input to be an array of campaigns (3 campaigns) and the output is a list of dates with the CTRs.

input: 111111111,2222222222,333333333 output: 1-1-2019: ctr: 2% 2-1-2019: ctr: 2% 3-1-2019: ctr: 2% ...

I have this, can you help me? thanks in advance

    $query = (new ReportQueryBuilder())
        ->select([
            'Date',
            'ctr'
        ])
        ->from(ReportDefinitionReportType::ACCOUNT_PERFORMANCE_REPORT)
        ->duringDateRange(ReportDefinitionDateRangeType::LAST_7_DAYS)
        ->build();
    // Download report as a string.
    $reportDownloader = new ReportDownloader($session);
    $reportSettingsOverride = (new ReportSettingsBuilder())->includeZeroImpressions(false)->build();

    $reportDownloadResult = $reportDownloader->downloadReportWithAwql(
        sprintf('%s', $query),
        $reportFormat,
        $reportSettingsOverride
    );
    //print "Report was downloaded and printed below:
";
    $datos = $reportDownloadResult->getAsString();
    return ($datos);
}
public static function main(){
    $oAuth2Credential = (new OAuth2TokenBuilder())->fromFile()->build();
    $session = (new AdWordsSessionBuilder())
        ->fromFile()
        ->withOAuth2Credential($oAuth2Credential)
        ->build();
    $string = self::runExample($session, DownloadFormat::XML);
    $xml = new \SimpleXMLElement($string);
    return $xml;}}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?