获取指向特定 Google Analytics(分析)视图的链接 [英] Getting a link to a specific Google Analytics view

查看:24
本文介绍了获取指向特定 Google Analytics(分析)视图的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 GA 帐户,具有定义的属性和视图.现在,我为一些用户授予了特定视图的查看权限.我如何以编程方式构建/获取一个直接 URL,让这些用户有权访问该视图/报告?

I have a GA account, with defined properties and views. Now, I gave viewing rights for a few users to a specific view. How can I construct/get programmatically a direct URL that will bring those users right to that view/report?

非常感谢!

推荐答案

首先让我们看一下特定视图的典型报告网址:

First lets take a look at an typical report url for a specific view:

https://analytics.google.com/analytics/web/#report/visitors-actives/a40777649w70913173p73156703/

注意模式:

BASE_URL = 'https://analytics.google.com/analytics/web/#report/'
REPORT_TYPE = 'visitors-actives/'
ACOUNT_ID = '40777649'
WEBPROPERTY_ID = '70913173'
PROFILE_ID = '73156703' # Also called the view Id.

您可以通过调用帐户摘要:列表 API 方法,它返回 帐户摘要:

You can retrieve this information programmatically by calling the Account Summaries: list API method which returns a list of Account Summaries:

{
  "id": string,
  "kind": "analytics#accountSummary",
  "name": string,
  "starred": boolean,
  "webProperties": [
    {
      "kind": "analytics#webPropertySummary",
      "id": string,
      "name": string,
      "internalWebPropertyId": string,
      "level": string,
      "websiteUrl": string,
      "starred": boolean,
      "profiles": [
        {
          "kind": "analytics#profileSummary",
          "id": string,
          "name": string,
          "type": string,
          "starred": boolean
        }
      ]
    }
  ]
}

  • ACCOUNT_ID 是顶级 acountSumaries.id.
  • WEBPROPERTY_IDaccountsumaries.webproperties[X].internalWebPropertyId.
  • PROFILE_IDaccountsumaries.webproperties[X].profiles[X].id
    • The ACCOUNT_ID is the top level acountSumaries.id.
    • The WEBPROPERTY_ID is the accountsumaries.webproperties[X].internalWebPropertyId.
    • The PROFILE_ID is the accountsumaries.webproperties[X].profiles[X].id
    • 现在有了这些信息,您可以重新构建指向特定视图的相关报告的 URL 链接.

      Now with this information you can recustruct the URL link to the report of interest for a particular view.

      FULL_URL = BASE_URL + REPORT_TYPE + 'a' + ACCOUNT_ID + 'w' + WEBPROPERTY_ID + 'p' + PROFILE_ID + '/'
      

      这篇关于获取指向特定 Google Analytics(分析)视图的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆