I have a Google Analytics view that combines traffic to multiple subdomains. It has an advanced filter set up to view full page URL in reports.

As expected when using this filter, when I go to Behavior | Site Content | All Pages and click a link for any page, the link doesn't work.

The reason it doesn't work is that GA concatenates my view's "Website's URL" value with the full page URL provided in the report. For instance, if "Website's URL" is set to https://www.example.com/ and I try to navigate from the report to a page with full URL sub.example.com/page, GA opens a popup with URL https://www.example.com/sub.example.com/page - obviously, this returns error 404.

I thought I could solve this problem by leaving "Website's URL" blank, but GA doesn't allow leaving it blank. Instead, it requires that Website's URL is a valid URL without parameters.

I hate fixing links opened from All Pages so much that I'm ready to write a simple redirect service for the links to work (e.g. https://www.example.com/redirect-service/https://sub.example.com/page would redirect to https://sub.example.com/page). However, that would force me to specify the URL of the redirect service - https://www.example.com/redirect-service/ - as the value of "Website's URL".

Here's the question: does GA only use the value of "Website's URL" for navigating to pages from reports, or is there another use of the setting? Would I corrupt my view by setting "Website's URL" to the redirect service?

  • 1
    On your server, couldn't you internally rewrite https://www.example.com/([a-z0-9]+.example.com/.*) to https://www.example.com/redirect-service/$1 so that you can handle the existing broken links without changing the website URL in GA? Sep 8 at 17:17
  • @StephenOstermiller That's certainly one way to achieve what I'm looking for, thanks! I could end up doing this, although I'm a bit concerned about possible performance impact of another rewrite rule on all traffic. Still, even if this is the way to go, the question of how "Website's URL" is effectively used still stands. Sep 8 at 19:49
  • I have a site with language subdomains and when I want to see stats for the various subdomains I create custom reports based on the host dimension. In my case the normal reports aren't useless though because my URL paths are the same between subdomain (en.example.com/page and fr.example.com/page). It sounds like your different subdomains have different URL paths, right? Sep 8 at 19:53
  • I just realized that with rewrite you wouldn't even need a redirect service. Have rewrite redirect https://www.example.com/([a-z0-9]+).example.com/(.*) to https://$1.example.com/$2 Sep 8 at 19:56
  • If you are worried about slowing down your server with excessive rewrite rules you can move many redirects out of rewrite rules into a 404 handler script that only runs after Apache can't find a document to serve: Implement lots of redirects (a million) without slowing down the site Sep 8 at 20:03

Your Answer

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

Browse other questions tagged or ask your own question.