Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.12 - Custom Variable includes wrong data #15137

Closed
ricardojsmarques opened this issue Nov 8, 2019 · 7 comments
Closed

3.12 - Custom Variable includes wrong data #15137

ricardojsmarques opened this issue Nov 8, 2019 · 7 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@ricardojsmarques
Copy link

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
Copy link
Member

sgiehl commented Nov 10, 2019

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

@ricardojsmarques
Copy link
Author

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
Copy link
Member

sgiehl commented Nov 10, 2019

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
Copy link
Member

tsteur commented Nov 10, 2019

@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 #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.

@ricardojsmarques
Copy link
Author

@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
Copy link
Member

tsteur commented Nov 11, 2019

@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

@viezel
Copy link

viezel commented Jan 22, 2020

@DDrjm See #15438. Lets upvote it, so we can get this fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

4 participants