首页 > 解决方案 > 为什么我的正则表达式包含过滤器不起作用(谷歌分析)?

问题描述

在谷歌分析中,我创建了以下包含过滤器:

^https:\/\/(my\..*|accounts\..*|maya\..*\/reports\/(mymessages|favorites)|maya\..*\/account\/notification|info\..*\/(heb|eng)\/management\/generalpages\/pages\/(personalfolder|registration|change_password|userssearchindex|security%20search)\.aspx).*

为了仅包含包含以下地址的URL :
https://my.tase.co.il
https://accounts.tase.co.il
https://maya.tase.co.il/reports/mymessages
https ://maya.tase.co.il/reports/favorites
https://maya.tase.co.il/account/notification
https://info.tase.co.ilManagement/GeneralPages/Pages/PersonalFolder.aspx
https: //info.tase.co.ilManagement/GeneralPages/Pages/Registration.aspx
https://info.tase.co.ilManagement/GeneralPages/Pages/Change_Password.aspx
https://info.tase.co.ilManagement/GeneralPages/ Pages/UsersSearchIndex.aspx
https://info.tase.co.ilManagement/GeneralPages/Pages/Security%20Search.aspx

但由于某种原因,我无法让它工作。我究竟做错了什么?

谢谢你的帮助!

标签: regexgoogle-analyticsgoogle-analytics-filters

解决方案


该模式与开头的链接不匹配,info.因为该模式指定info\..*\/(heb|eng)并且在示例数据中没有hebeng存在。

您可以删除该部分或使用以这些 url 开头的完全匹配的模式:

https:\/\/(?:(?:accounts|my)\.tase\.co\.il|maya\.tase\.co\.il\/(?:reports\/(?:mymessages|favorites)|account\/notification)|info\.tase\.co\.il\/Management\/GeneralPages\/Pages\/(?:PersonalFolder|Registration|Change_Password|UsersSearchIndex|Security%20Search)\.aspx).*

查看正则表达式演示


推荐阅读