0

我正在使用 Google Analytics API,并成功地从中提取了大量数据。帐户提要 ( https://www.google.com/analytics/feeds/accounts/default) 返回与您获得授权的帐户相关联的网络媒体资源列表,格式如下(大多数实际值已替换,不确定其中的敏感程度):

<entry gd:etag="W/&quot;<charsblahblahblah>.&quot;" gd:kind="analytics#account">
    <id>http://www.google.com/analytics/feeds/accounts/ga:########</id>
    <updated>2011-08-04T12:01:33.467-07:00</updated>
    <title>www.afifthofnothing.com</title>
    <link rel="alternate" type="text/html" href="http://www.google.com/analytics"/>
    <dxp:property name="ga:accountId" value="#####"/>
    <dxp:property name="ga:accountName" value="My Sites"/>
    <dxp:property name="ga:profileId" value="######"/>
    <dxp:property name="ga:webPropertyId" value="UA-#####-#"/>
    <dxp:property name="ga:currency" value="USD"/>
    <dxp:property name="ga:timezone" value="America/Los_Angeles"/>
    <dxp:tableId>ga:#######</dxp:tableId>
</entry>

我以前一直使用该<title>元素作为属性的基本 URL,这通常可以工作,因为这是 Google Analytics 分配给属性的默认标题。但是,如果用户将其编辑(我正在查询我的最终用户的帐户,因此我无法控制)类似“A Fifth Of Nothing”之类的内容,那么 Analytics API 将尽职尽责地将其作为标题返回,留下我无法找到基本 URL。

我搜索了Analytics API 文档并四处搜索,搜索了 SO,但没有看到任何从 Google Analytics 获取网络资源的基本 URL 的方法。我尝试通过OAuth Playgroundid查询该字段以获取更多信息,它只是给了我更多错误,说最后一部分必须是./default

有没有办法从数据 API 获取用户属性的基本 URL?看起来这将是非常基本的东西。如果不是,我将不得不求助于尝试标题,如果它不像 URL,则让用户自己输入,这不是很友好,但这是我目前唯一能想到的.

4

2 回答 2

1

使用的策略是对 ga:hostname 维度进行查询以获取 ga:visits 并降序排序。您通常可以使用它来显示主机/基本 url。

我认为“基本网址”没有这样的属性,因为从技术上讲,您可以将谷歌跟踪代码放在多个网站上。在这种情况下,您将有多个基本 url。

于 2011-09-13T04:40:12.900 回答
0
View Full Page URL In Reports
By default, the data in your reports includes only the Request URI and not the domain name:

URL of page: http://www.example.com/foldername/page.html
Request URI: /foldername/page.html
Domain name: www.example.com

If you'd like to see the domain name as well as the Request URI in your reports, create an Advanced filter for your view with the following settings:

Filter Type: Custom filter > Advanced
Field A: Hostname
Extract A: (.*)
Field B: Request URI
Extract B: (.*)
Output To: Request URI
Constructor: $A1$B1

Note that creating URL rewrite filters like the one described above can affect Analytics' ability to match your goals properly.

If you're using Analytics filters to rewrite your URLs, you need to make sure that your goal settings reflect these changes. Like all filters, URL-rewrite filters are applied to the raw data coming into your account, before goals are processed. As a result, your goal and funnel URLs should reflect the final, rewritten format of the URL. For example:

If your site's URL:

/directory/download/file.html

is rewritten by a filter to look like:

/download/file

then your goal should match

/download/file and not /directory/download/file.html
于 2020-07-20T07:10:56.963 回答