How do I measure and give people access to their reports for some page sections / categories / mini-sites / languages?
Sometimes your website or app includes multiple “sections” (or page “categories” or “mini-site” or “multi-tenants”), 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”).
Solution 1) Tracking each website section as its own website and use Roll-Up Reporting
This works by tracking each “section” in its own separate website in Matomo and use Roll-up Reporting to get aggregated reports across all sections/websites.
This allows you to easily grant people read or write access to the report about a particular “section” without giving them access to data for all “sections”.
To track the data, first you will need to create new websites in Matomo. Then in the JavaScript tracking code, the line containing _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.
You can also give users explicit permission to access any of these websites reports by creating new users and managing their permissions.
If you end up creating many websites, you might want to automate the process of creating/updating/deleting websites via the SitesManager API.
Solution 2) One website, one custom dimension, and several custom reports and/or segments
In this solution we will track the “section” of your websites in a new Custom Dimension, and then create Custom Reports to see reports for each of the categories you need a report for.
Create a new custom dimension in “Action” scope
First, you will need to create a Custom Dimension of Action scope called for example “Section”. Secondly, you will need to track this dimension value in your website. For example you can use JavaScript and call the 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.
(recommended) Create a new custom dimension in “Visit” scope
If you track Goals or Ecommerce then we also recommend to create a second custom dimension, but this time in the scope “Visit” (the first dimension above was in the scope “Action”). Having the custom dimension also in the “Visit” scope will make it easy for you to attribute Goals and/or Ecommerce orders to the last visited “Section” of your website. So you will see a list of all your website sections/categories (that were last viewed before the user converted) and the following metrics will be displayed: number of visits, conversions, conversion rate, revenue, etc. This valuable data will be displayed below every Goal or Ecommerce report.
Creating the “Sections” custom reports
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 Custom report in Matomo. For this custom report we will 1) select dimensions of “Page URL” or “Page Title” for example, and 2) also define a “Filter” such as Where custom dimension 'Section' is 'News'
.
Then when viewing this custom report, it will only show those pages that match the filter and therefore belong to this particular section of your website. Learn more about creating custom reports in the User guide.
(If you end up creating many reports, you might want to automate the process of creating/updating/deleting custom reports via the CustomReports API, contact us for more information).
(optional) Create segments for important “Sections”
You can also create Segments such as Visits where custom dimension 'Section' is 'Profile'
and apply the segment to any report in Matomo, and the reports will only include users that match the segment. You can also get scheduled email reports created and including data for these segments only. Note that when you’re using Segments, the segmented reports will include all the pages these visits did, so in the pages report you will see pages where ‘Section’ is ‘Profile’ but also any other page from these visits such as ‘Sports’, ‘Technology’, ‘Ecology’, etc.
If you end up creating many segments, you might want to automate the process of creating/updating/deleting segments via the SegmentEditor API.