简体   繁体   English

我可以让Google Analytics(分析)将某些页面视为相等吗?

[英]Can I make Google Analytics see some pages as equal?

I am currently using the Google Analytics API to get information about visits to my web site. 我目前正在使用Google Analytics(分析)API来获取有关访问我的网站的信息。 One thing I notice is that in some cases I get two different results for the same page because the way the user accessed them was different. 我注意到的一件事是,在某些情况下,由于用户访问它们的方式不同,所以我在同一页面上得到两个不同的结果。 For example, I get separate results like this: 例如,我得到这样的单独结果:

http://www.example.com/mypage - 500 pageviews
http://example.com/mypage - 500 pageviews

What I want is for them to be considered the same so the result I get back is consolidated like so: 我想要的是让他们被认为是相同的,所以我得到的结果是这样合并的:

http://example.com/mypage - 1000 pageviews

Is this possible using PHP client code to access the API? 使用PHP客户端代码访问API是否可行? My current code includes these lines: 我当前的代码包括以下几行:

filter = 'pageviews > 100 && pagePath !~ ^\/$';
$ga_month->requestReportData(ga_profile_id, array('hostname', 'pagePath'), array('pageviews'), '-pageviews', $filter, $start_date_month, $end_date);

I've seen this code for using search and replace functions to combine results in the Google documentation , but I don't know how to integrate the following JSON request into the PHP code above: 我已经在Google文档中看到了使用搜索和替换功能合并结果的代码,但是我不知道如何将以下JSON请求集成到上述PHP代码中:

  "searchAndReplaceDetails": {
    "field": string,
    "searchString": string,
    "replaceString": string,
    "caseSensitive": boolean
  },

您可以使用搜索和替换过滤器,此资源( https://support.google.com/analytics/answer/1034834?hl=zh_CN )告诉您如何执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM