RegEx for Dynamic URL Goals settings

房东的猫 提交于 2019-12-11 06:12:51

问题


I have tried to work this RegEx to set up a goal in GA for 2 days, but I cannot get my head around it...

The URL format is like this:

/purchase.php?cDd=1&transaction_id=xxxxxxx&verify=xxxxxxxxxxxxxxxx=&method=creditcard&type=purchase

transaction_id= is populated with a sept of numbers verify= is populated by a string of numbers, letters in both caps and lower case

Basically I would like to only match URLs which finish by &method=creditcard&type=purchase

I have tried to just put &method=creditcard&type=purchase but it does retrieve other URLs too.


回答1:


Put a $ sign at the end of your regex.

This way you enforce to only match url's that end with &method=creditcard&type=purchase

^/purchase.php\?cDd=1&transaction_id=[0-9]*&verify=[a-zA-Z0-9]*=&method=creditcard&type=purchase$

or

&method=creditcard&type=purchase$

would do the trick




回答2:


For any dynamic URL

^/(.*)&method=creditcard&type=purchase$


来源:https://stackoverflow.com/questions/2881098/regex-for-dynamic-url-goals-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!