簡體   English   中英

Google Adwords統計信息不正確

[英]Google Adwords Incorrect statistics

我正在使用Google AdWords PHP API訪問我們帳戶的統計信息。 但是,我通過api從統計信息中獲得了一些非常奇怪的讀數。 我正在嘗試訪問個人廣告或廣告組的統計信息。 但是,返回的統計信息與客戶中心的信息相去甚遠。 我正在使用的代碼:

$user->SetClientCustomerId($clientId);
$adService = $user->GetService("AdGroupAdService", ADWORDS_VERSION);
$selector = new Selector();
$selector->fields = array("Id", "Name", "Clicks", "Impressions", "Cost");
$selector->predicates[] = new Predicate("AdGroupId", "IN", array($adGroupId));
$selector->dateRange = $dateRange;
$selector->paging = new Paging(0, AdWordsConstants::RECOMMENDED_PAGE_SIZE);
do {
        // Make the get request.
        $page = $adService->get($selector);

        if (isset($page->entries)) {
                foreach ($page->entries as $ad) {
                     $newLineObject->adName = $ad->name;
                     $newLineObject->clicks = $ad->ad->AdStats->clicks;
                     $newLineObject->impressions = $ad->adStats->impressions;
                     $newLineObject->cost = $ad->ad->AdStats->cost->microAmount/ AdWordsConstants::MICROS_PER_DOLLAR;
                }
        }
        else {
          print "No matching ads were found.\n";
        }
        $selector->paging->startIndex += AdWordsConstants::RECOMMENDED_PAGE_SIZE;

} while ($page->totalNumEntries > $selector->paging->startIndex);

當我打印結果時,我得到的數字遠遠大於客戶中心顯示的數字。 例如,對於一個partiuclar廣告,API報告了2.000.000印象,而客戶中心顯示了56.000。

我究竟做錯了什么?

您的代碼對我來說似乎是正確的。 但是,您可能遇到的問題是代碼中的日期范圍與客戶中心中看到的日期范圍不同。 進行交叉檢查時,請確保保持相同的日期范圍。

嘗試廣泛使用上面詳述的方法后,我完全更改了代碼。 現在,我使用AdHoc報表(在此處https://developers.google.com/adwords/api/docs/guides/reporting進行描述)。 AdWords開發人員向我建議了這種方法。 雖然這並不能從字面上解決我的問題(即,為什么上面的代碼返回錯誤的統計信息),但它確實提供了一種簡單而干凈的方法來正確獲取數據。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM