@mattab opened this Issue on November 7th 2017 Owner

Use case

As a user when I view a report where a segment is applied, in some cases I will see "There is no data for this report" and may think that "My segment doesn't work!". But in many cases it is just a matter of waiting for some time and the segment data will be shown later once it's been processed. So I'd like to see a note that the data will be available later and I should check back after some time, rather than worry the service does not work.

This is the use case on the Piwik Cloud-hosted for some customers.

Solution

Whenever the requested segment hasn't been processed yet by core:archive for the requested date/period/site, we need to detect that "This segment hasn't yet been processed but will be later".

  • When we detect that the Segment exists in the DB and set to "reports are pre-processed", then we can display a message:

Segment 'XYZ' not applied
You are requesting data for the Segment 'XYZ'. Your segmented reports haven't yet been processed by the system and they will be available in a few hours.
Because all your reports for segment 'XYZ' will be processed by the system over the next few hours, we kindly invite you to check again in a few hours.
Please note that you can already test whether your segment will work and match your users by applying your segment [a]in the Visitor Log[/a]. When using the Visitor Log, you can see in real time which visits and actions were matched by your segment. This can help you confirm your Segment is constructed well and matches your users and actions as you expect to.

  • We would link to the Visitor Log for the same date/period/site so user can see directly whether there will be later data in the report originally requested.
  • This Modal shouldn't be displayed in pages where there are only Real time reports (visitor log, real time map, real time forms, real time videos, etc.)
  • This is very similar to #12253 and likely we would want to use a same UX solution & similar wording (the modal solution seems fine, or would it be better to use a Notice or Warning notification?)

Refs:

  • Show an error in API response for "real time segments" and "custom segments" when browser_archiving_disabled_enforce=1 in #12255
  • Show a modal for "real time segments" when browser_archiving_disabled_enforce=1 in #12253
@sgiehl commented on November 7th 2017 Member

I'm wondering what the easiest way would be to determine if data for as segment hasn't been processed yet. API would return 0 values in this case, but also if there simply were no visits.

@mattab commented on November 7th 2017 Owner

it's tricky. it would have to be an "internal" flag or some sort set by the ArchiveProcessor/Loader.php or core/DataAccess/ArchiveSelector.php which would then be accessed down the line somehow?

@sgiehl commented on November 8th 2017 Member

Investigated the archiving process today. As far as I have seen as soon as a segment has been processed a Done-Flag will be stored in the according numeric table. If all plugins were processed a flag like Done+md(segmentString) will be available. So maybe the simplest solution would be to check if the flag is available

Powered by GitHub Issue Mirror