Reputation: 53
I'm trying to setup tracking in Google Analytics.
The goal URL is:
www.example.com/jdsfdf?sdfffs#/thankYou
Every time Google Analytics sees #/thankYou
in the URL, I want it to attribute that as a conversion.
How can I use regex to say if the URL contains #/thankYou, then it's a conversion
?
Upvotes: 3
Views: 13407
Reputation: 879
This regex will work for you (apparently no escaping is needed on the forward slash):
#/thankYou$
The dollar sign indicates that you require this string to appear a end of the URL. If you don't require that the thankYou come at the end, then remove the dollar sign.
Upvotes: 0
Reputation: 36592
You don't need a regex for an exact string match, but if you must:
/#\/thankYou/
or as @Sundar points out, you may not need to escape anything:
#/thankYou
Upvotes: 1