Google アナリティクス API を使用して、アナリティクス アカウントからウェブ プロパティ情報を取得しています。
ただし、分析にログインすると、Web サイトは 1 つしかありませんが、API を介していくつかの (古いサイトと削除されたサイト) を取得します。
私のコードは次のようなものです:
var provider = new WebServerClient(GoogleAuthenticationServer.Description)
{
ClientIdentifier = _appId,
ClientSecret = _appSecret
};
var auth = new OAuth2Authenticator<WebServerClient>(provider, x => new AuthorizationState { AccessToken = token });
var analyticsService = new AnalyticsService(auth);
var accounts = analyticsService.Management.Accounts.List().Fetch();
foreach (var account in accounts.Items)
{
var webProperties = analyticsService.Management.Webproperties.List(account.Id).Fetch();
// todo: determine if web property is still in use?
}
コードから、どれがまだアクティブであるかをどのように確認できますか?