@ddrjm opened this Issue on November 8th 2019

I'm currently using CustomVariable tracking on one website in order to track multiple article categories at the same time.

I have a report segment setup setup in the following way in the interface

Custom Variable name 1 (scope page) contains economy

On the website I'm tracking the Custom Variable as follows:

_paq.push(['setCustomVariable', 1, "Category", ['economy', 'highlight'], scope="page"]);

I've double checked the values set on the website, and I'm seeing articles that correspond to an unrelated category, for example science, and that are classified as science, appear on the economy segment.

How can I fix this?

@sgiehl commented on November 10th 2019 Member

Afaik setCustomVariable expects the third parameter to be a string, but you are sending an array

@ddrjm commented on November 10th 2019

Afaik setCustomVariable expects the third parameter to be a string, but you are sending an array

From what I saw in piwik.js, it calls String, on the third parameter, effectively converting it into a string.

@sgiehl commented on November 10th 2019 Member

Ok. So you expect the value to be something like economy,highlight?
The segment you mentioned Custom Variable name 1 (scope page) contains economy refers to the variable name. In your example that would be "Category".
Maybe I got something wrong, but economy is set in the value and not in the name. Maybe you need to use Custom Variable value 1 (scope page) contains economy instead?

@tsteur commented on November 10th 2019 Member

@ddrjm

I've double checked the values set on the website, and I'm seeing articles that correspond to an unrelated category, for example science, and that are classified as science, appear on the economy segment.

I might be misunderstanding but this might be related to https://github.com/matomo-org/matomo/issues/11900 which we fixed in 3.12 and is now expected behaviour. Say you segment "value = economy" then before it would have only shown these custom variables in the report, or only page urls that had this particular custom variable. But now we have fixed the behaviour of segments to also show all custom variables and page urls of a visit that had the "custom variable value = economy". This is expected and how the segment feature should work. It basically no longer acts as a filter, but as an actual segment now.

So it would be expected that when you go to the custom variables report, that you also see other custom variables values.

@ddrjm commented on November 11th 2019

@sgiehl

Ok. So you expect the value to be something like economy,highlight?

Yes, so I can then filter by the articles that contain economy in the variable

The segment you mentioned Custom Variable name 1 (scope page) contains economy refers to the variable name. In your example that would be "Category".
Maybe I got something wrong, but economy is set in the value and not in the name. Maybe you need to use Custom Variable value 1 (scope page) contains economy instead?

I've tried by value and by name.
The name attempt was due to having found in the log_visit table in the custom_var_k1 column, the Custom variable values and having found in the same table in the custom_var_v1 the value page which confused me a bit.

@tsteur

I might be misunderstanding but this might be related to #11900 which we fixed in 3.12 and is now expected behaviour. Say you segment "value = economy" then before it would have only shown these custom variables in the report, or only page urls that had this particular custom variable. But now we have fixed the behaviour of segments to also show all custom variables and page urls of a visit that had the "custom variable value = economy". This is expected and how the segment feature should work. It basically no longer acts as a filter, but as an actual segment now.

Consulting the visitor log, this seems to be what is happening. Also, given that we have ~2 to ~4 pages per session, most of the time in different category articles, by what you said, it would make sense that all pages of a visit would be listed when segmenting by category.

That would make sense in a Visit scope, in a Page scope, I would expect to only have the pages that are affected by x segment regardless of "Visitor Path" the visit has taken.

How can I "restore" the old behavior and effectively filter the page views by category?

Also, The report I'm using is in the Page Titlesone.

@tsteur commented on November 11th 2019 Member

@ddrjm it's expected behaviour also in page scope. AFAIK Google Analytics for example behaves the same. You can restore old behaviour by setting a config setting in your config/config.ini.php i

[General]
enable_segments_cache = 0

but we likely remove this in Matomo 4. We don't have filters yet in Matomo which is what you want. They are not needed so often though that's why it has rather low priority. Another workaround be to use Custom Reports

This Issue was closed on November 11th 2019
Powered by GitHub Issue Mirror