【问题标题】:How to use Google Analytics Reporting to Get the Average Session for a given date range?如何使用谷歌分析报告来获取给定日期范围内的平均会话?
【发布时间】:2016-11-18 20:27:15
【问题描述】:

我正在使用 .NET,并且我已经安装了谷歌分析的 NuGet 包:

 Install-Package Google.Apis.AnalyticsReporting.v4

API 在这里:https://developers.google.com/analytics/devguides/reporting/core/dimsmets#view=detail&group=session

我需要使用以下 API:

ga:avgSessionDuration

我已经为凭据创建了一个 API 密钥,并且还知道我的 ViewId 和 ClientId。

如何使用 .NET 客户端库来访问它?

【问题讨论】:

    标签: .net api google-analytics


    【解决方案1】:

    这就是我的做法:

    1 创建 Google 服务帐户

    2 授予您的 Analytics 帐户权限,以允许 Google 服务帐户查看数据

    3 设置认证http://www.daimto.com/googleanalytics-authentication-csharp/

    4 在此处查看您需要查询的指标/维度以及数据范围https://ga-dev-tools.appspot.com/query-explorer/

    5 初始化步骤3中提到的AnalyticsService

    6 生成请求 {YourAnalyticsService}.Data.Ga.Get("ga:{viewid}", {start_date},{end_date}, ga:{metric});

    【讨论】:

    • 在哪里可以找到客户端密码?无法从控制台找到它?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多