Using Regular Expressions for GA goals & Funnel pages
This popular discussion was copied from the former Help Forum, answered by Zorin Radovancevic (RS)
Question: I am trying to figure out how to tell GA how to include 2 parts of a URL, while ignoring variable elements in the middle of the URL.
How do i distinguish Step 1 as the 'quickQuestions' step, and Step 2 as the 'createAccount' step. I am thinking that I need to use Regex to tell GA to look for /enrollment-tool plus quickQuestions.
Do I need to use regex in this case above, or something else?
Answer: 1st thing you need to solve is the values you are passing to Google analytics in the page dimension which are explicitly not allowed such as (bold):
You have to exclude these query params in the view settings (cell,email,last_name,first_name)!
2nd If you want to create goals inside GA based on the hash part of the URL you would need to override the default page value when sending a pageview and edit it to pass location.pathname + location.search + location.hash.
So your 1st step would be match regex 'enrollment-tool.*quickQuestion' and your 2 nd step in the funnel would be 'enrollment-tool.*createAccount'.