匹配Google Analytics的网址 [英] match URL for Google Analytics

查看:111
本文介绍了匹配Google Analytics的网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





如何匹配以下两个感谢页面?



首先,谢谢你的页面:mydomain.com/paid/49549/



我只想在付费是域名之后的第一个文件时触发它,因为付费有时被添加到中间或结尾的其他页面,49549是动态文件夹/参数



第二页谢谢你:/你好/ DYNAMICstring / geek / 1619 /付/ /



所以你好和极客和付费是唯一的静态文件夹,而DYNAMICstring和1619是动态文件夹。



非常感谢

Hi,

How do I match the below two thank you pages?

First thank you page: "mydomain.com/paid/49549/"

I want the trigger it only when "paid" is the first file after after the domain name because "paid" sometimes is added to other pages in the middle or at the end and the "49549" is dynamic folder/parameter

2nd thank you page: "/hello/DYNAMICstring/geek/1619/paid/"

so "hello" & "geek" & "paid" are the only static folders while "DYNAMICstring" & "1619" are dynamic folders.

Thank you so much

推荐答案

对于正则表达式部分,你可以开始看看MDN: JavaScript正则表达式 [ ^ ](如果JavaScript是语言)

此处还有正则表达式信息 [ ^ ]



拥有一个工具,您可以以可视方式测试表达式。我自己使用这个应用程序 RegexTest [ ^ ],但还有其他一些,包括在线工具。



如果我理解正确,你想匹配

For the regular expression part you can start to look here at MDN: JavaScript Regular Expressions[^] (If JavaScript is the language)
And also here Regular Expression Info[^]

It is also useful to have a tool where you can test expressions in a visual way. I use this application myself RegexTest[^], but there are others as well, including online tools.

If I understand you correctly, you want to match
mydomain.com/paid/49549/



但不是


but not

/hello/DYNAMICstring/geek/1619/paid/



如果是这种情况,这个表达式就可以了:


If that is the case, this expression will do the trick:

^\S+?/paid



它基本上意味着它会在第一个之前匹配任何字符<字符串中的code> / 然后已支付必须遵循。


这篇关于匹配Google Analytics的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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