How to combine hostnames for the same site?

I’m converting to Piwik PRO from Google Analytics. In the Piwik PRO reports, I’m seeing URLs for the same page with different hostnames listed as separate line items, for example:

Note that the only difference is the hostname, and both hostnames point to the same site. In GA, these are combined and listed simply as /page.html. I would like Piwik PRO to work the same way, or at least to treat and as the same thing. Is there a way to achieve this?

Hi! There are a few ways in which this can be addressed:

  • setting up a 301 redirect on the tracked site to make sure that there is only one valid URL for the same page (it could be also beneficial from the SEO perspective)
  • fixing the URL on the tracking level. To do that, you can add a custom tag in the tag manager module that will modify the URL before sending it to the analytics backend. Here is the command that can be used. Current url is always available under location.href.
    You can also remove the domain entirely (e.g. by calling _paq.push(['setCustomUrl', window.location.pathname.substr(1) +]); ).

Thanks for the tips. It would be beneficial if you could do some filtering after the fact not only on hostname, but also for example to filter out spam traffic. Is this something that’s on the roadmap?

For filtering after the fact, you can use segmentation or dimension value grouping. I understand that it’s not that convenient when working with lots of unique values, so I’ll add a feature request regarding this topic.


Another option would be creating a custom report, using our extraction feature to extract the path of a Page URL

Regarding the Spam part, you can enable the “collect data only from known sites” in the site config

Make sure you enter a full URL like in the basic info settings. You can add more URLs if you track a few sites with the same tracking code. Separate with the enter or tab key.


1 Like