通过 Google AdWords php API 获取客户发票

发布于 2024-10-28 21:14:15 字数 87 浏览 6 评论 0原文

我想使用 Google AdWords API 通过 php 提取客户发票。这将使我的客户计费过程更加简化。我该如何利用 AdWords API 来做到这一点?

I want to use the Google AdWords API to pull my clients invoices via php. This will make the process of billing my clients much more streamlined. How would I do this utilizing the AdWords API?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

归途 2024-11-04 21:14:15

我假设您想要提取与特定帐户和/或活动相关的成本数据,以便将其放入发票中。最简单的方法是使用 AdWords API 的报告服务。 Google 提供了一个 PHP 库来执行此操作,您可以从 http://code 下载.google.com/p/google-api-adwords-php/ 下载内容还包含演示如何下载报告的示例。

I'm assuming you want to pull out the cost data associated with specific accounts and/or campaigns so it can be put into invoices. This simplest way to do this is using the reporting service of the AdWords API. Google provides a PHP library to do this that you can download from http://code.google.com/p/google-api-adwords-php/ The download also contains an example demonstrating how to download a report.

哆啦不做梦 2024-11-04 21:14:15

生成自己的发票时要小心。由于点击欺诈调整是一个持续的过程,除非您在 Google 生成自己的发票的同时提取报告,否则您的数字很可能与 Google 计费的数字不同。如果您代表有权访问自己的 adWords 帐户的客户生成发票,请准备好解释为什么两张发票不匹配。

Be careful about generating your own invoices. Because click fraud adjustment is an ongoing process, unless you pull your report at the exact moment as Google generates their own invoice, there is a good chance that your numbers will be different from what Google bills. If you are generating invoices on behalf of clients who have access to their own adWords accounts, be prepared to explain why the two invoices don't match.

牵强ㄟ 2024-11-04 21:14:15

不幸的是,目前似乎无法从 Google Adwords 帐户检索发票。我想出的解决方法是通过gapi (http://code.google.com/p/gapi-google-analytics-php-interface/)访问链接的Google Analytics帐户并自己生成发票。以下是获取特定日期范围内的 AdWords 数据的方法:

require("gapi.class.php");
$gapi = new gapi("email","password");
$ga_dimensions = '';
$ga_metrics = array('impressions','adClicks','adCost','CTR','CPC');
$start_date = "2011-03-01";
$end_date = "2011-03-31";
$gapi->requestReportData($ga_profile_id,$ga_dimensions,$ga_metrics,'','',$start_date,$end_date,1,10000);
$ga_adwords_data = $gapi->getResults();
foreach($ga_adwords_data as $ga_adwords_stat) {
    $ga_adwords_stats = array('impressions' => $ga_adwords_stat->getImpressions(),
                              'clicks'      => $ga_adwords_stat->getAdClicks(),
                              'cost'        => $ga_adwords_stat->getAdCost(),
                              'ctr'         => $ga_adwords_stat->getCTR(),
                              'cpc'         => $ga_adwords_stat->getCPC());
}
print_r($ga_adwords_stats);

Unfortunately, it seems that at this current time, there is no way to retrieve invoices from a Google Adwords account. The workaround I came up with, was to access the linked Google Analytics account via the gapi (http://code.google.com/p/gapi-google-analytics-php-interface/) and generate the invoice myself. This is how to get adwords data for a specific date range:

require("gapi.class.php");
$gapi = new gapi("email","password");
$ga_dimensions = '';
$ga_metrics = array('impressions','adClicks','adCost','CTR','CPC');
$start_date = "2011-03-01";
$end_date = "2011-03-31";
$gapi->requestReportData($ga_profile_id,$ga_dimensions,$ga_metrics,'','',$start_date,$end_date,1,10000);
$ga_adwords_data = $gapi->getResults();
foreach($ga_adwords_data as $ga_adwords_stat) {
    $ga_adwords_stats = array('impressions' => $ga_adwords_stat->getImpressions(),
                              'clicks'      => $ga_adwords_stat->getAdClicks(),
                              'cost'        => $ga_adwords_stat->getAdCost(),
                              'ctr'         => $ga_adwords_stat->getCTR(),
                              'cpc'         => $ga_adwords_stat->getCPC());
}
print_r($ga_adwords_stats);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文