@mfb opened this Issue on November 20th 2019

I noticed a discrepancy between the nb_pageviews reported by Actions.get segmented by a custom dimension, e.g. ?module=API&method=Actions.get&idSite=1&format=json&period=day&date=2019-11-18&segment=dimension3==99095

and the nb_hits reported for that custom dimension by CustomDimensions.getCustomDimension, e.g. ?module=API&method=CustomDimensions.getCustomDimension&idSite=1&format=json&period=day&date=2019-11-18&idDimension=3

The nb_pageviews and nb_hits numbers are always different, but it seems like they should be the same - although I must be missing something? I wonder which numbers are correct?

@tsteur commented on November 20th 2019 Member

@mfb not sure I fully understand. They may not be the same for example if other actions such as downloads or outlinks or so have the same custom dimension maybe? I suppose we're talking here of custom dimensions in scope "action" and not "visit"? How much different are the numbers?

@mfb commented on November 20th 2019

Yes, I'm talking about a custom dimension in scope "action".

Usually the numbers are pretty close, but sometimes they are off by a factor of 4.

As an example, if I get the numbers for a specific custom dimension segment, ?module=API&method=Actions.get&idSite=1&format=json&period=week&date=2019-11-17&segment=dimension3==101882 I get "nb_pageviews":4877

If I get the list of custom dimensions, ?module=API&method=CustomDimensions.getCustomDimension&idSite=1&format=json&period=week&date=2019-11-17&idDimension=3 the row for 101882 has "nb_hits":1198

@tsteur commented on November 20th 2019 Member

Actually, this is expected I reckon because of #11900

module=API&method=Actions.get&idSite=1&format=json&period=day&date=2019-11-18&segment=dimension3==99095

The segment dimension3 would include all pageviews of all visits that have had viewed a page during with the given custom dimension value during that visit. Before Matomo 3.11.0 the number would have likely been the same but this was actually due to a bug.

here's how to workaronud if needed: https://github.com/matomo-org/matomo/issues/15137#issuecomment-552571872

@mfb commented on November 21st 2019

I see. Well, for future reference, we definitely want to track individual actions w/ custom dimensions and variables. The fact that this count extends to other actions in the same visit is not how we want the action scope to function.

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