The safest way to track goal URLs in Google Analytics
How you can go about tracking your goal URLs in Google Analytics
I was recently digging into some analytics and I wondered why a goal I was tracking had stopped working, I decided to do some digging.
Turns out that I was looking for a page being hit with my destination being set to "Equals to" and passing in the page I was expecting. For example;
Destination URL Equals To:
For ages this worked like a charm, but recently the task that would send people to that page started adding some extra parameters to the URL, so the URL getting hit was
This does not trigger my event because
The safer thing to do is actually something that to some folk my appear scary, that is to use the Regular Expression option.
Changing Equals To to Regular Expression in Google Analytics
For something simple like my use case the conversion is painfully simple, I needed to change to Regular Expression and change the input to;
The ^ says the following stuff needs to appear at the start of the URL and all the \ is doing is letting the Regular Expression know to not treat the / as anything special and that it is part of the string we care about.
If you want to convert yours and are having a hard time please just leave a comment and I can take a look!