查询 Google Analytics API 以获取特定页面的统计信息(按页面过滤)

发布于 2024-08-03 21:44:55 字数 603 浏览 10 评论 0原文

此查询按流量来源提供访问次数;

https://www.google.com/analytics/feeds/data?ids=ga%3A123456&dimensions=ga%3Asource%2Cga%3Amedium&metrics=ga%3Avisits&sort=-ga%3Avisits&start-date=2009 -08-12&end-date=2009-08-26&max-results=50

但是,当指定过滤器时: ga:pagePath==/Default.aspx - 我得到零结果

https://www.google.com /analytics/feeds/data?ids=ga%3A123456&dimensions=ga%3Asource%2Cga%3Amedium&metrics=ga%3Avisits&filters=ga%3ApagePath%3D%3D%2FDefault.aspx&sort=-ga%3Avisits& start-date=2009-08-12&end-date=2009-08-26&max-results=50

如何过滤 ga:pagePath?

This query gives visits by traffic source;

https: //www.google.com/analytics/feeds/data?ids=ga%3A123456&dimensions=ga%3Asource%2Cga%3Amedium&metrics=ga%3Avisits&sort=-ga%3Avisits&start-date=2009-08-12&end-date=2009-08-26&max-results=50

But, when specifying a filter: ga:pagePath==/Default.aspx - I get zero results

https: //www.google.com/analytics/feeds/data?ids=ga%3A123456&dimensions=ga%3Asource%2Cga%3Amedium&metrics=ga%3Avisits&filters=ga%3ApagePath%3D%3D%2FDefault.aspx&sort=-ga%3Avisits&start-date=2009-08-12&end-date=2009-08-26&max-results=50

How can i filter on ga:pagePath?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

江南月 2024-08-10 21:44:55

query1.Dimensions = "ga:日期,ga:页面路径"
query1.Metrics = "ga:pageviews"
query1.Sort = "ga:日期,ga:页面路径"
query1.GAStartDate = "2010-09-01"
query1.GAEndDate = "2010-09-10"
query1.Filters = "ga:pagePath=~/abc*"

希望这对您有用。

query1.Dimensions = "ga:date,ga:pagepath"
query1.Metrics = "ga:pageviews"
query1.Sort = "ga:date,ga:pagepath"
query1.GAStartDate = "2010-09-01"
query1.GAEndDate = "2010-09-10"
query1.Filters = "ga:pagePath=~/abc*"

hope this works for you.

一身仙ぐ女味 2024-08-10 21:44:55

这是针对您的问题的一个非常晚的理论...

假设您的内容索引为 /Default.aspx,您的数据查询看起来是有效的。我已在我的 asp.net 站点上重现了该查询并获取了结果。我可以看到您的查询可能会产生空结果的两种潜在情况。

Analytics 中的过滤器机制区分大小写,因此,如果链接偶然以 default.aspx 形式进入页面,则“Default.aspx”的过滤器将不会命中。我没想到它会以这种方式工作,但最近我不得不返回并修复一些查询,因为当发生大小写不匹配时它们会产生空结果。

第二个可能的问题与“默认文档”的使用有关。如果进入您网站的链接没有文件名(“/”或“/somepath/”),并且“default.aspx”在 IIS 中设置为“默认文档”,那么您确实希望过滤器为 ga:pagePath ==/。

Here's a very late theory to your question...

Your data query looks valid assuming you have content indexed as /Default.aspx. I've reproduced the query on my asp.net site and get back results. I can see two potential scenarios where your query may produce empty results.

The filter mechanism in Analytics is case sensitive so if by chance links come into the page as default.aspx your filter for 'Default.aspx' won't hit. I wouldn't have guessed it works this way but lately I've had to go back and fix some of our queries as they produced empty results when case mismatches occurred.

The second possible issue relates to the use of 'Default Documents'. If links are coming into your site without a file name ('/' or '/somepath/') and 'default.aspx' is setup as a 'Default Document' in IIS, then you really want the filter to be ga:pagePath==/.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文