matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.3k stars 2.59k forks source link

Possibility to define multiple values for a custom dimension #16156

Open mattab opened 5 years ago

mattab commented 5 years ago

For example when using Custom Dimensions of scope "Page" as a way to track categories of an article, often an article can belong to multiple categories. Therefore it would be useful to be able to track multiple values for a same dimension. eg. the ability to define an array of values instead of just a string.

mattab commented 5 years ago

It is interesting to note that it seems possible to track multiple values for a given dimension using the "old" Custom Variables feature. (which we plan to deprecate in the next year in https://github.com/matomo-org/matomo/issues/11524 although we will still support the feature afterwards in the Marketplace)

-> With Custom variables one can define the same variable in different "index / slots" and the multiple values will be recorded. This is useful when for example tracking multiple categories for a given Page or Article. Then one could send the data with for example a Tracking API request of piwik.php?idsite=1&rec=1&cvar={"1":["Page Category","Sports"],"2":["Page Category","Regional"]}

In the report of custom variables one can see the multiple values eg. custom vars

(It may be the first time we realise a given use case/feature is offered in Custom Variables but not in Custom Dimension?)

DiegoPino commented 5 years ago

@mattab is this a planned feature for 4.x? We have some need for this. (Digital Object repositories with many metadata values per key we need to segment on, hierarchical membership of a page/Digital Object inside a collection, etc)

To allow many values, right now we are basically tracking the page view many times (once per value). Not a "big" issue if you are always segmenting by the dimension value and all your reports depend on that. But totally an issue when dealing with global stats.

I even thought of building a custom Plugin to deal with this (if can totally understandhow to make that plugin to track a view once only but generate many entries into the dimension and also integrate correctly with Segmentation, but then that seems less portable than depending on a core (or core provided plugin) feature.

Another option would be for us to go back to Variables (but they lack other needs). Is deprecating them still planned?

Thanks!

mattab commented 5 years ago

We currently don't plan to implement this feature. Deprecating custom variables is still planned, but the plugin will stil be available on the Marketplace anyway so will keep working.

benwarfield-usds commented 4 years ago

Is there some way to request that the feature be considered? Or is it ruled out by some architectural choice in the design of the new plugin? It's a little rough to have to tell my users "half of you want something that requires the deprecated (and presumably unmaintained) plug-in, and half of you want the new features in the new plug-in."

mattab commented 4 years ago

"half of you want something that requires the deprecated (and presumably unmaintained) plug-in, and half of you want the new features in the new plug-in."

Afaik the "define multiple values" would be the only benefit of custom variable over custom dimensions. It's usually quite an edge case, so almost everyone would be better with custom dimensions.

benwarfield-usds commented 4 years ago

Indeed, it is the only feature that matches that description, as far as I’m aware. I’m not sure that telling my colleagues that they’re an edge case will really improve their situation, though. 😁

raDiesle commented 3 years ago

As far as I understand, right now it is not supported to provide multiple values for Custom Dimensions and it is not planned right now, correct?

In my use case, I just want to track user roles to group data sets by it. What would you recommend to resolve this?

tsteur commented 3 years ago

Yes @raDiesle it's not planned yet unfortunately. Maybe custom variables would help meanwhile? It's otherwise hard to recommend anything as it might depend on the use case. would maybe using multiple dimensions help like userRole1, userRole2, etc? This might work if only segmenting is needed. Grouping by it be probably not possible though.

raDiesle commented 3 years ago

Thanks for quick reply! In my special case, right now it is sufficient to resolve by your suggested solution - so thanks for verification. In the future, for my specific application, there will be user-groups & business-groups, where a user can have n-m combinations of a rule. The Cloud solution supports 25 custom dimensions, so maybe it will fit in.

jayhoogle commented 3 years ago

This is a must-have for our analytics setup - we track impressions of content that can often have multiple authors, something we need to keep track of for the correct distribution of royalties. Without support for multiple values we have to manually search our CMS for the authors which is time-consuming and should be unnecessary. Are you planning to implement this feature?

Chardonneaur commented 3 years ago

Hello, I also have this need for a client of mine. This is definitely the use case that @mattab described, one page can have multiple tags associated to it, for example, a blog post can be assigned to sport and to the taxonomy culture and to the taxonomy personality and to the taxonomy leisure. 1) If I set this as different custom dimensions, I will be stuck when creating a custom report as it can only go up to 3 dimensions. And nothing is saying that in one case it may go into slot 1, and in the other case into slot 2. 2) If I send all those values like this: _paq.push(['setCustomDimension', 1, 'Culture']); _paq.push(['setCustomDimension', 1, 'Sport']); _paq.push(['setCustomDimension', 1, 'Transport']); _paq.push(['trackPageView']); it won't work neither as the last custom dimension is the only one which will be taken into consideration 3) If I use events like this: _paq.push(['trackPageView']); _paq.push(['trackEvent', 'Pageview', 'Competence', 'Culture']); _paq.push(['trackEvent', 'Pageview', 'Competence', 'Sport']); _paq.push(['trackEvent', 'Pageview', 'Competence', 'Transport']); then the bounce rate will go to 0% which would be an unexpected behaviour.

-> Is there then really a need to discontinue the custom variables? Shouldn't it be renamed? Because as far as I know, this is also useful for custom search engine results.

justinberedo commented 2 years ago

Hi,

A client of ours needs this functionality. The purpose is for tracking multiple roles for an individual. For now, the custom variable plugin has this feature. But it's sad to see that support is to be dropped. Could we request having this functionality for custom dimensions? I think it would be very useful.

Thanks!

heurteph-ei commented 2 years ago

Why not tracking a dimension with value: Culture|Sport|Leisure. Then when using segments, you can ask for the dimension containing Sport?

Or also if you really needs this feature, don't hesitate to sponsor Matomo...

JiveDig commented 1 year ago

+1 on needing this, for very similar use-cases as others, primarily posts in multiple categories.

Starker3 commented 7 months ago

We have another user requesting this feature today. Would be great to have this implemented. Their use case would be to track the User roles for a logged in user where there are multiple different roles that a user can have, which means there can be many different combinations of roles.

MrJibus commented 2 months ago

+1, we have a use case when we need a custom dimension with multiple values.

VaDominikKienzler commented 2 months ago

+1 very important feature