Recently I had an analytics problem where I wanted to track a page, however the linked pages on the website had various tracking parameters on the query string. For example:
- http://www.website.com/campaigns/page.aspx
- http://www.website.com/campaigns/page.aspx?icn=tracking1
- http://www.website.com/campaigns/page.aspx?icn=tracking2
- http://www.website.com/campaigns/page.aspx?icn=tracking2&icd=moretracking
I wanted to group all of the URLs together to see the stats as one entity. To do this I used this regular expression:
http://(www\.website\.com\/campaigns\/page\.aspx){1}([\w- ./?&=]*)?
I’m sure there are a few ways to do it, however this expression worked very well for me.