0

只使用Analytics(分析)API,我發現你可以通過指定adwordsCampaignID但是拉的AdWords數據,我無法弄清楚如何檢索當前視圖的adwordsCampaignID或者通過過濾當前視圖的某些屬性來獲取它。在谷歌Analytics(分析)API當前視圖檢索adWordsCampaignID

我在幾十個域中循環,需要拉動每個視圖的adwordsCampaignID將其插入到以下函數中。 一個

function getAdWords(&$analytics, $profileId) { 
    return $analytics->data_ga->get(
     'ga:' . $profileId, 
     '2014-07-01', 
     '2014-09-09', 
     'ga:adClicks,ga:CTR,ga:impressions', 
     array('dimensions' => 'ga:adwordsCampaignID,ga:adwordsAdGroupID,ga:adGroup,ga:keyword','sort' => 
      '-ga:impressions','filters' => 'ga:adwordsCampaignID=='.'8486***','max-results' => '50') 

     ); 

}

Something along the lines of $results = getAdwordsCampaignID($analytics); 

回答

0

打開你可以拉只使用谷歌Analytics(分析)API AdWords的數據(只要你的GA帳戶連結到AdWords帳戶)。

可以做這樣的:

function getAdWords(&$analytics, $profileId) { 
    return $analytics->data_ga->get(
     'ga:' . $profileId, 
     '2014-07-01', 
     '2014-09-09', 
     'ga:adClicks,ga:CTR,ga:impressions', 
     array('dimensions' => 'ga:adwordsCampaignID,ga:adwordsAdGroupID,ga:adGroup,ga:keyword','sort' => 
      '-ga:impressions','filters' => 'ga:adwordsCampaignID=='.'84*690*','max-results' => '50') 

     ); 

} 

不過,也有侷限性。您必須擁有adWordsCampaignID。據我所知,無法僅使用GA API檢索視圖的adWordsCampaignID。您必須使用CustomerID變量加入AdWords + GA API之間的數據。

如果您正在努力實現這一目標,那麼Google API Query Explorer將非常​​有幫助。