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.
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".
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.
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.
it's tricky. it would have to be an "internal" flag or some sort set by the
core/DataAccess/ArchiveSelector.php which would then be accessed down the line somehow?
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
md(segmentString) will be available. So maybe the simplest solution would be to check if the flag is available
So maybe the simplest solution would be to check if the flag is available
Ok. could you try this and let us know if it works nicely?