The safest way to track 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: /thank-you-for-your-order/

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 /thank-you-for-your-order/?foo=bar.

This does not trigger my event because /thank-you-for-your-order/?foo=bar/thank-you-for-your-order/

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!

Recent posts View all


Active Storage - resizing images on upload



iOS simulator battery level

I have always enjoyed this fun feature