【问题标题】:RegEx for Dynamic URL Goals settings动态 URL 目标设置的正则表达式
【发布时间】:2010-05-21 09:57:56
【问题描述】:

我已尝试使用此 RegEx 在 GA 中设定一个目标 2 天,但我无法理解它...

网址格式如下:

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

transaction_id= 填充了一组数字 verify= 由一串数字、大写和小写字母组成

基本上我只想匹配以&method=creditcard&type=purchase 结尾的网址

我尝试只输入&method=creditcard&type=purchase,但它也会检索其他 URL。

【问题讨论】:

    标签: regex google-analytics dynamic-url goal-tracking


    【解决方案1】:

    在您的正则表达式末尾添加一个$ 符号。

    这样你强制只匹配以&method=creditcard&type=purchase结尾的url

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

    &method=creditcard&type=purchase$
    

    会成功的

    【讨论】:

    • @gaaustralia:如果这个答案解决了你的问题,你可以通过接受它来表达你的感激之情(单击左侧的复选标记),并且(一旦你的声誉超过 15 分)也支持它。
    【解决方案2】:

    对于任何动态网址

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-19
      • 2016-01-17
      相关资源
      最近更新 更多