LW IT Solutions
« Blog Overview /Digital Analytics/Tutorials / Tutorial: Implementing Custom Dimensions in Matomo
This post in other languages:

Tutorial: Implementing Custom Dimensions in Matomo

Custom Dimensions in Matomo provide the capability to track specific attributes beyond standard metrics. By defining unique parameters, it becomes possible to segment data based on custom logic, such as content categories, membership levels, or author names. The following guide outlines the end-to-end implementation process.

Step 1: Defining Dimensions in the Admin Panel

The configuration begins within the Matomo dashboard. Navigate to the Administration (cog icon) menu and locate the Custom Dimensions section. Within this view, a new dimension is created by assigning a name and selecting the appropriate scope:

  • Action Scope: Data is tracked for specific interactions (e.g., page views, downloads).
  • Visit Scope: Data is tracked for the duration of the entire user session.

Upon saving, an Index ID is generated. This ID acts as the unique identifier required for the tracking code.

Step 2: Technical Implementation

The implementation requires passing the custom data to Matomo before the trackPageView event is executed. The setCustomDimension method is used for this purpose.

// Example: Setting a dimension with Index ID 1
_paq.push(['setCustomDimension', 1, 'Premium User']);
_paq.push(['trackPageView']);

In the context of Tag Manager, a “Custom Dimension” tag or a custom HTML variable is used to push this value into the _paq array dynamically based on specific trigger conditions.

Step 3: Data Analysis and Usage

Once data collection begins, Custom Dimensions become available as secondary dimensions within standard reports, or as primary filters in Custom Reports. This allows for granular data segmentation, such as comparing conversion rates between different membership types or content categories.

Sample Data: Membership Levels (Visit Scope)

Membership Level Page Views Avg. Session Duration
Premium 12,450 04:30
Standard 85,200 01:15
Lukas Wojcik

Lukas Wojcik

Systems architect and technology enthusiast specializing in scalable tracking solutions, GMP Stack (GA4 & GTM), and robust backend architectures. Advocate for clean code and privacy-first design.

Get in Touch

Briefly describe your project or inquiry for a tailored response. This site is protected by reCAPTCHA.

Leave a Reply

Your email address will not be published. Required fields are marked *

ALL ARTICLES & CATEGORIES

Data Privacy

Digital Analytics

Digital Marketing

IT & Networks

Raspberry PI

Smart Home

Tutorials

Tutorials

Tutorials

Tutorials

Tutorials

Uncategorized

Web Development

Wordpress Hacks

Home Sitemap