Sometimes your website or app includes multiple “sections” (or page “categories” or “mini-site”), and you want to track and report them separately from each other. For example your website is translated in multiple languages, or when your app is serving multiple markets, and you want to see reports for each language or market (“section”).
There are two solution you can choose from:
1) Track all “sections” in the same website in Matomo using a custom dimension and use segments to get reports for each section.
2) Track each “section” in its own separate website in Matomo and use Roll-up to get aggregated reports across all sections/websites.
Please find more information about two solutions below.
Solution 1) One website, one custom dimension, multiple segments
In this solution we will track the “section” of your websites in a new Custom Dimension, and then create Segments to see reports for each of the categories you need a report for.
setCustomDimension function. Or if there is a URL parameter which has your “category” value, then you can configure your dimension to use this URL parameter as the dimension value. Learn how to create and track a custom dimension in the User guide.
Once the custom dimension is tracked you will be able to view the list of all values in the report. See example in the online demo.
Finally, you want to see the detailed report for each section of your website. To be able to view any Matomo report for a “section”, we will create a segment in Matomo:
Visits where custom dimension 'Section' is 'Private'. Then you can apply the segment and view your dashboard, graphs, reports for visitors who viewed pages belonging to this particular section of your website. Learn more about creating segments in the User guide.
When you then create a segment for each of your “Sections” then you will get detailed reports just a click away.
Solution 2) Separate websites and Roll-Up
Alternatively it may sometimes be easier to create separate websites in Matomo for each of your “sections”. Creating separate websites in Matomo has some advantages:
- You can easily grant people read or write access to the report about a particular “section” without giving them access to data for all “sections”.
- You don’t need to create Dimensions nor Segments to view reports since they are already separated in different websites.
This solution is also recommend if each of your mini-sites is on a different sub-domain.
_paq.push(['setSiteId', 'ID_SITE_HERE']); will need to be referencing the correct website ID so you need a it of logic to set
ID_SITE_HERE depending on which “section” your visitors are currently browsing.
Once the data is tracked, you can use Roll-Up reporting feature to aggregate your websites together in a Roll-Up and view all reports across all websites. Learn more in the Roll-Up Reporting user guide.