Is it possible to create a custom dimension in Google Analytics based off a URL part?

I have a series of URLs in the format /title/id/xx where I want to group by the id portion. I know I can set up a content group for each id however this is cumbersome as we have so many of them and they keep growing.

Is there any way to make this more dynamic so that I can use it in a custom report?

2 Answers 2


Another possible solution would to create a new view under your UA property with a filter that is configured as the following:

Filter type: Predefined

Include only | Traffic to the hostname | That Begin With

then set your hostname using regular expression for your URI

for example in your case will likely be ^/title/id/(.)

You can read more about regular expressions here: Google Answers

  • Interesting angle. Would this allow me to then report on the /id/ report and group anything under that, without having to specify each individual ID?
    – Carl
    Feb 6, 2016 at 7:59
  • That is the idea, just telling it to capture everything that contains /title/id/ request URI and count it under that view. Best of luck -p
    – Avail
    Feb 8, 2016 at 15:16

Yes, absolutely. With each pageview you send, you would need to capture, via some JS, the specific part of the string you are interested in and then push that into a CD. The CD would be hit-scoped.

  • Sounds like a plan. Would this do anything to update historical data though?
    – Carl
    Feb 2, 2016 at 22:55
  • No, historical data would not be altered.
    – nyuen
    Feb 2, 2016 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.