嘗試從C#中的Google Analytics API測試此帳戶供稿。AccountFeed返回null,GA API
無論如何,這裏是代碼示例,由於某些原因,accountFeed保留爲空,即使我提供帳戶信息。不知道這是否是版本問題。
public AccountFeedExample()
{
// Configure GA API.
AnalyticsService asv = new AnalyticsService("gaExportAPI_acctSample_v2.0");
// Client Login Authorization.
asv.setUserCredentials(CLIENT_USERNAME, CLIENT_PASS);
// GA Account Feed query uri.
AccountQuery query = new AccountQuery("https://www.googleapis.com/analytics/v2.4/management/accounts");
//Tried to manually insert the date info, still shows the accountfeed as null.
query.StartDate = new DateTime(2014, 1, 1);
query.EndDate = new DateTime(2014, 1, 14);
// Send our request to the Analytics API and wait for the results to
// come back.
accountFeed = asv.Query(query);
}
試圖將它在這個格式重新寫: http://www.googleapis.com/analytics/v2.4/management/accounts/1234/webproperties/UA-1234-2/profiles
從以下鏈接: https://developers.google.com/analytics/devguides/config/mgmt/v2/mgmtFeedReference#accountFeed
似乎不工作,不知道我錯過了什麼。
只是通過您的教程,它正是我所需要的,我也得到了nuget安裝。謝謝,給你檢查和嘖嘖的+1。 –