【问题标题】:Setting up correct REGEX for conversion tracking target-URL in Google Analytics在 Google Analytics 中为转化跟踪目标 URL 设置正确的正则表达式
【发布时间】:2021-01-21 19:25:23
【问题描述】:

来自挪威的问候!

我是在 Google 分析中设置 REGEX 的新手,非常感谢您的帮助! :) 我想跟踪从我的网站发送的活动表单(如收据网址),但我需要设置一个正则表达式来跟踪我网站上所有活动的响应。

这些字符串需要被跟踪(以及类似的未来一次):

https://www.domain.no/**Campaigns**/MYcampaignname?**mode=received&formid**=thisand093that123 https://www.domain.no/**Campaigns**/Another-campaign-name?**mode=received&formid**=76280&goback=https%3a%2f%2fwww.domain.no%2fCampaign https://www.domain.no/**Campaigns**/Name-of-This-campaign?**mode=received&formid**=76283

我在 GA 中尝试了几种不同的正则表达式,但我没有让它们起作用.. 我尝试过的一些:

/Campaigns/.?mode=received&formid=.

/Campaigns/([A-Z]+[a-z]+[0-9]+)?mode=received&formid=[^/]

非常感谢您的帮助!

【问题讨论】:

  • 特殊字符需要转义,特别是?应该是\?
  • 你可能想要^/Campaigns/[^/]+\?mode=received&formid=[^/]+
  • 非常感谢!它工作得很好! :) :) :)
  • 不客气,一个小改动是在末尾添加一个美元符号,像这样^/Campaigns/[^/]+\?mode=received&formid=[^/]+$
  • 谢谢!现在做了一些测试,最后跟踪没有使用'$'。收据页面上的实际字符串如下所示:domain.no/Campaigns/…

标签: regex google-analytics conversion-tracking


【解决方案1】:

使用

^/Campaigns/([\w-]+)\?mode=received&formid=([^/]+)

proof

说明

MODE EXPLANATION
^ the beginning of the string
/Campaigns/ '/Campaigns/'
( group and capture to \1:
[\w-]+ any character of: word characters (a-z, A-Z, 0-9, _), '-' (1 or more times (matching the most amount possible))
) end of \1
? '?'
mode=received&formid= 'mode=received&formid='
( group and capture to \2:
[^/]+ any character except: '/' (1 or more times (matching the most amount possible))
) end of \2

【讨论】:

  • @KingKongFive 请接受/支持答案
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-07-30
  • 2014-12-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多