Segmentation Question


We have a requirement to count the number of visits by Gender and by Age range (Gender and Age(range 1= 18-25, 2= 26-35…etc) information is entered by the user in one of the website pages).

I understand that we need to use Segmentation to achieve the above but have few questions around the implementation.

In the Java script,
Where exactly do we place the segmentation url information?
Can we use more than one url? (I am assuming that the above requirement requires the usage of two segments). If so, can any one please provide some sample code which has multiple urls of segmentation.

Appreciate if some one points me in the right direction.

You can use segmentation to segment all piwik reports by age, gender, etc.

First you need to track age and gender. To do so you can use a Cusotm Variable: Using Custom Variables in Piwik (Tutorial) - Analytics Platform - Matomo and Custom Variables Analytics - Analytics Platform - Matomo


I highly appreciate your time and response. But on a frank note…none of your replies are any help to me, I have two post one for custom variable and other for segmenetation, you just replied them with one liners, which never took me in any direction.
Being new to piwik, i have already invested time to read all these pages much before reaching out to you,

From the above query, all i wanted to knwo is how and where do we place the code for segmentation, I understand we assign a custom variable and use the custom variable in your segment as explained in Segmentation - Compare segments of visitors - Analytics Platform - Matomo

But where do i place the code for the same, Will it be in the Javascript snippet, if so each time i want the report for different segments how will i achieve the same?

Any help or explanation would be great.

if you have invested much time researching, please put the things you have tried here and what does not work. Asking for a broad question will lead to a broad answer :slight_smile:

Happy New Year! If you are still using Piwik and interested in the awesome new feature of “Creating a Custom Segment in Piwik and apply to reports in Real time!” we need YOUR help, with a little or big donation at:

This will allow to dynamically add or edit, a new set of rules for example “Show all visitors from USA and using Firefox and using Google”. This will be done via a simple to use interface. See screenshots and more info here:

We are crowd funding the future of Piwik and this feature in particular. With your help we can do it.