I would like to use Google Analytic's visitor flow to understand the behaviour of my visitors.

My current visitor flow looks like this:

Visitor flow

As you can see, my URL structure is not really friendly to this tool, and thus I'm having a hard time extracting any useful information from there.

I've seen that analytics.js allows us to send custom variables, including overriding the path.

I guess that I could override the path to give all pages of the same type a common (fake) path, something like:

/restaurant/123/index => /restaurant
/restaurant/456/index => /restaurant

/restaurant/123/order => /order
/restaurant/456/order => /order

but I would be losing the potentially precious information that the original path represents.

Is it possible to send a custom variable to Google Analytics instead, and have the visitor flow use the custom variable instead of the path when displaying the above flow?

  • I'd have to look into it further, but you might be able to use two separate pageview functions if you want to do as you're saying and categorize them into a lump, but also preserve the original for granularity. – Ally Jan 13 '14 at 20:01

Hopefully in the future this will be achievable with the recently launched page group feature, but right now I think you'll have to make a hack.

If preserving the original URL is important, I would recommend setting up a new view and then using filters to rewrite/aggregate the URLs.

AFAIK, you can't use custom dimensions in filters (yet), so you would have to set up a an advanced filter for each "type" of URL you want to rewrite.

For example:

Filter type:           Advanced
Field A:               Request URI
Field A pattern:       ^/restaurant/\d+/index
Output To:             Request URI
Output To value:       /restaurant
Field A required:      Yes
Override Output Field: Yes

Now all pageviews to /restaurant/xxxxx/index will be aggregated under /restaurant in your new view, but still be reported with the proper URL in the old one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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