This isn’t a post about why you should track goals on your website. I’ll assume you already know. Instead I’d like to talk about a problem I ran into while setting up a goal for my company’s ecommerce website and my solution.
When someone goes through the checkout process on our site the url’s look something like:
1) /cart
2) /session/new?return_to=%2Forders%2Fnew
3) /orders/new
4) /orders/3575/payment
5) /orders/3575/confirmation
Notice the dynamic url’s in numbers 3 and 4? After doing a little research I stumbled upon an informative post by Lunametrics, the comments section especially has a wealth of information about setting up goals with dynamic url’s. However, the examples provided didn’t fit my exact situation so I had write the following regular expressions.
1) ^/cart
2) ^/session/new
3) ^/orders/(?=new)
4) ^/orders/b0*[1-9][0-9]{0,8}b/(?=payment)
5) ^/orders/b0*[1-9][0-9]{0,8}b/(?=confirmation)

This will work for a range of numbers from 1 – 1,000,000,000. When we reach 1 billion orders I plan on putting a big flashing neon colored sign on the website announcing the fact. Just like McDonald’s does on the Golden Arch.
Be sure you’ve set Match Type to Regular Expressions in the goal information settings.
Hopefully this helps anyone who finds themselves in a similar situation.
Tags: analytics

blog









I have set up a goal which has a static URL /student/purchaseconfirmation but each step in my funnel has a dynamic URL.
For example: One of the pages has the following URL: /index/document/id/21567 where everything else remains the same except the last digits i.e. 21567.
I need to set up a funnel that can track these pages with dynamic URL’s but I am unsure if I should use this format: /index/document/id/=[0-9].+ or is there any other format that I should use. I have my match type set as “Head Match” but I am not sure if this is going to work.
Also do I need to change the tracking code?
I appreciate the help.
Thanks in advance.
In this way, can we track dynamic values from the dynamic URL?
The answer is YES Jeremy.