2.1K members online now
2.1K members online now
Ask questions about filter set-up and issues with using filters in Google Analytics reports
Guide Me

Filters for URL Reformatting?

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I'm hoping someone can check the logic of my filters. Since it takes up to twenty-four hours to see a change, the latency between my regex and the results is very long. I'm trying to change the format of Request URIs from



Currently I have four advanced filters. I have set my regex in bold type:

  1. Extract A is Request URI (.*) -> User Defined $A1
  2. Extract A is Request URI ((subdirectory1)|(subdirectory2)|(subdirectory3)|(subdirectory4)).* -> Custom Field 1 $A1
  3. Extract A is Request URI (\/[sb]\/) [s and b are the variables in the URL]  and Extract B is Custom Field 1 (.*) which I'm then -> in Custom Field 1 $A1/$B1 (override output field is checked)
  4. Extract A is Request URI www\.mygreatsite\.com and Extract B is Custom Field 1 (.*) which is -> Request URI $A1/$B1


The way I think this works is: I declare a variable. Then I extract the subdirectories (and everything trailing them) from the URL and add them to Custom Field 1. Then I am getting the two variables (s or b) and prefixing them to the subdirectories with slashes before and after. Then I am getting the site domain and prefixing it to the string in Custom Field 1, which should be /b/subdirectory*/content and assigning it to the Request URI. Through all this I am ignoring the "customer" and "anotherVariable" portions of the original URL. So I expect my result should be:*/content or*/content


However, my URLs are currently unchanged. I've been running a two day test. Any help is greatly appreciated. 

1 Expert replyverified_user
Marked as Best Answer.
Accepted by topic author Adoniram S
October 2016

Re: Filters for URL Reformatting?

Rising Star
# 2
Rising Star
Hey Adoniram,

Have you considered doing this at the collection level rather than at the processing level? That is, shape the hit before it get's to GA? Would that work for you?

It's super simple to do in GTM and fairly straighforward wit a little code to do it dynamically in the GATC.


Theo Bennett
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Filters for URL Reformatting?

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Theo,

Thanks - I probably can but the deployment window for that sort of thing is even longer, which is why I was hoping to get a quick win with filtering. I also really wish I understood what I was doing wrong, as a matter of learning. Any thoughts? If push comes to shove, I will try GTM instead.



Filters for URL Reformatting?

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭


Did you find the right way?