为所有语言代码添加一个排除过滤器

时间:2022-06-01 18:39:38

I have website with many languages with address like http://domain.com/<lang>/

我的网站有很多语言,地址如http://domain.com/ /

I would like to create exclude filter in one of my views to report global traffic but i don't want to create dozen of exclude filter for each country (easy to forget to add some lang code).

我想在我的一个视图中创建排除过滤器以报告全局流量,但我不想为每个国家/地区创建十几个排除过滤器(很容易忘记添加一些lang代码)。

Is this right to use custom exclude filter for Request URI with regex like ^\/[a-z]{2}\/ to exclude all requests which begins with /xx/ like /en/ /de/ etc.

对于使用正则表达式(如^ \ / [a-z] {2} \ /的请求URI使用自定义排除过滤器是否正确,以排除所有以/ xx / like / en / / de /等开头的请求

Thanks for help.

感谢帮助。

1 个解决方案

#1


0  

You may use

你可以用

^/[a-z]{2}(/|$)

There is no need escaping / in GA regex and (/|$) (match / or end of string) alternation group will make the / optional at the end of the input.

没有必要转义/在GA正则表达式和(/ | $)(匹配/或字符串结束)交替组将在输入的末尾使/可选。

#1


0  

You may use

你可以用

^/[a-z]{2}(/|$)

There is no need escaping / in GA regex and (/|$) (match / or end of string) alternation group will make the / optional at the end of the input.

没有必要转义/在GA正则表达式和(/ | $)(匹配/或字符串结束)交替组将在输入的末尾使/可选。