Google Analytics throws 403 error

前端 未结 3 630
無奈伤痛
無奈伤痛 2021-01-22 02:01

I am attempting to download metric data from Google Analytics using C# and am performing user authentication with OAuth 2.0. I\'m using the Installed Application autho

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-22 02:16

    //Thanks for this post. The required profile id can be read from the account summaries.

    Dictionary profiles = new Dictionary();

            var accounts = service.Management.AccountSummaries.List().Execute();
            foreach (var account in accounts.Items)
            {
                var profileId = account.WebProperties[0].Profiles[0].Id;
    
                profiles.Add("ga:" + profileId, account.Name);
            }
    

提交回复
热议问题