Google Analytics正则表达式,用于匹配指定路径级别的页面URI [英] Google Analytics regular expression for matching page URIs at specified path levels

查看:333
本文介绍了Google Analytics正则表达式,用于匹配指定路径级别的页面URI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Google Analytics中为页面级报告构建正则表达式,以匹配存在于路径/目录中指定级别的页面,并排除报告中超出该级别的页面。



更具体地说,为了仅显示报告中第5个路径级别的页面URI,或者更确切地说,仅包含5个/的URI,不再包含其他内容。



(Google Analytics中的独立深入内容报告仅提供路径中的4个级别的分隔,因此在此情况下不适用)。

任何帮助将不胜感激。



谢谢。

编辑:



使用下面的示例,我现在可以构建一个匹配以下页面URI的正则表达式:

  / about / team / member1 / bio / info 
/ about / team / member2 / bio / address
/ about / team / member2 / bio / address?= 2335
/ about / team / member3 / bio / contact
/ about / team / member3 / bio / contact / method
/ about / team / member4 / bio / p321
/ about / team / member4 / bio / p321 / test



<但是我希望正则表达式排除第3,5和7行中的上面的页面,或者在路径中超过5级的任何其他页面URI。此外,只需要补充一点,路径中的第5级可以包含任何字母和/或数字。

不知道GA使用哪种正则表达式,但这是相当标准的,并匹配除3,5和7以外的所有行。

  ^ (?:/ [a-zA-Z0-9] +){1,5} 

如果GA不支持非捕获组,请使用以下命令:

  ^(/ [a-zA-Z0- 9] +){1,5} $ 


I am trying to build a regular expression for a page-level report in Google Analytics to match pages that exist at a specified level in the path/directory, and exclude pages in the report beyond that level.

More specifically, to only show page URIs in the report that are at the 5th path level, or rather, URIs that contain 5 "/"s only, and no more.

(The seperate drill-down content report in Analytics only offers separation to 4 levels in the path, which is therefore not suitable in this case.)

Any help would be much appreciated.

Thanks.

Edit:

Using an example below, I am currently able to build a regular expression that matches the following Page URIs:

/about/team/member1/bio/info
/about/team/member2/bio/address
/about/team/member2/bio/address?=2335
/about/team/member3/bio/contact
/about/team/member3/bio/contact/method
/about/team/member4/bio/p321
/about/team/member4/bio/p321/test

However I would like the regular expression to exclude the pages above in rows 3,5 and 7 or any other page URIs for that matter that exceed 5 levels in the path. Also, just to add, that the 5th level in the path could contain any letters and/or numbers.

解决方案

I'm not sure which regex flavor GA uses, but this is fairly standard and matches all the rows except 3,5 and 7.

^(?:/[a-zA-Z0-9]+){1,5}$

In case GA doesn't support non-capturing groups, go with this:

^(/[a-zA-Z0-9]+){1,5}$

这篇关于Google Analytics正则表达式,用于匹配指定路径级别的页面URI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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