2010-04-09 75 views

回答

0

看看XML account feed reference與從API返回的所有數據。
Here訪問所有重要的帳戶供稿信息的Java示例:

for (AccountEntry entry : accountFeed.getEntries()) { 
    System.out.println(
     "\nWeb Property Id = " + entry.getProperty("ga:webPropertyId") + 
     "\nAccount Name = " + entry.getProperty("ga:accountName") + 
     "\nAccount ID  = " + entry.getProperty("ga:accountId") + 
     "\nProfile Name = " + entry.getTitle().getPlainText() + 
     "\nProfile ID  = " + entry.getProperty("ga:profileId") + 
     "\nTable Id  = " + entry.getTableId().getValue() + 
     "\nCurrency  = " + entry.getProperty("ga:currency") + 
     "\nTimeZone  = " + entry.getProperty("ga:timezone") + 
     (entry.hasCustomVariables() ? "\nThis profile has custom variables" : "") + 
     (entry.hasGoals() ? "\nThis profile has goals" : "")); 
    } 

這是一個樣的結果:根據要求

Web Property Id = UA-4276604-4 
Account Name = www.mainsite.net 
Account ID  = 4246204 
Profile Name = www.systempuntoout.com 
Profile ID  = 26084768 
Table Id  = ga:26084768 
Currency  = USD 
TimeZone  = Europe/Rome 

使用下面的代碼來獲取網站:

entry.getTitle().getPlainText() 
+0

好的。但哪一個是網站? – Chez 2010-04-09 15:18:04

+0

更新..使用getTitle()。getPlainText()。 – systempuntoout 2010-04-09 19:44:01