2014-03-13 44 views
1

我要設置用戶註冊爲谷歌分析目標,但註冊後的着陸頁是不同的,所以我會添加一個參數像registration_completed =真匹配在谷歌Analytics(分析)我的目標URL與正則表達式

是什麼Google Analytics(分析)網址中使用的正確正則表達式是否與此匹配?

所以它應該包含registration_completed = TRUE,並在其後?&之前,和&#或沒有。

/registration-completed.html?registration_completed=true 
/registration-completed.html?registration_completed=true&message=welcome 
/registration-completed.html?message=welcome&registration_completed=true 
/registration-completed.html?message=welcome&registration_completed=true#some-anchor 

用戶也降落在其他頁面比registraton-completed.html,否則,我只想用該網址進行跟蹤。

回答

2

試試這個:

^/registration-completed\.html\?([\w&=]*)registration_completed=true([\w&=]*)#?(.*)$ 

與regexr測試 - http://regexr.com?38gl4

編輯

要匹配任意頁面

^(.*)\?([\w&=]*)registration_completed=true([\w&=]*)#?(.*)$ 

新regexr - http://regexr.com?38h71

+0

也許我錯誤地進行了測試,但它不匹配'/contact.html?registration_completed = true'之類的東西,那麼第一個url(例如contact.html)就可以是任何東西。 – adrianTNT

+0

@adrianTNT請參閱編輯 – dtyler

相關問題