我能让Google Analytics看到一些页面吗


Can I make Google Analytics see some pages as equal?

我目前正在使用Google Analytics API获取有关访问我的网站的信息。我注意到的一件事是,在某些情况下,我会得到同一页面的两个不同结果,因为用户访问它们的方式不同。例如,我得到这样的单独结果:

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

我想要的是让他们被认为是一样的,这样我得到的结果就被合并了:

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

这是否可以使用PHP客户端代码访问API?我当前的代码包括以下几行:

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

我在Google文档中看到过使用搜索和替换函数来组合结果的代码,但我不知道如何将以下JSON请求集成到上面的PHP代码中:

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

您可以使用搜索和替换过滤器以及此资源(https://support.google.com/analytics/answer/1034834?hl=en)告诉你怎么做。