-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Provide an API for plugins to display (multiple) reports in a page #7822
Comments
In Piwik we have the following layouts in report pages:
To be considered
Rough idea, very experimental, possibly doesn't work
|
@mattab I'm a little confused here. While working on a proof of concept I noticed that a report belongs to a category, for example the VisitorLog belongs to the category "Live!". In the UI it is listed under "Visitors" though and the category is pretty much ignored except for widgets. I was wondering why we do have categories? Was it only for the list of widgets? And why is the list of widgets completely different to the menu? Aren't reports harder to find this way? Was it imaginable that we do use the same structure in WidgetsList as in the menu? If we have a category for the widgetsList, how would we name the "category" (eg Visitors) and "subcategory" (eg Engagement) for the menu? Note to myself: We might as well want to refactor the widgets API and make it similar to a Report to have one class per widget eg |
While working on #7861 I noticed that all reports, that define a menu title (and therefore have a reporting page), also define a widgets. So I'm thinking changing this into
This might simplify a lot of things. Can anyone think of a use case when we want to put a report on a page but not as widget? Also |
Some more thoughts on what we want to achieve etc
|
Good to see this progress towards simpler & meaningful core APIs, and a better generic analytics platform. Looking forward to seeing where it will take us! |
FYI: I spent one or two days trying to fix this screenshot test but give up: http://builds-artifacts.piwik.org/ui-tests.7822_4/14275.7/UIIntegrationTest_visitors_engagement It seems related to triggering the archiving in The UI itself works and all the code etc but as the archiving is triggered earlier different numbers are shown. |
Sorry to hear the troubles with UITestFixture and OmniFixture.sql... is there something we could investigate to unblock you on this? or do you have a plan regarding this UI test btw in the Processed screenshot is looks like "actions by returning visits" and "actions per returning visits" are switched, ie. the metrics should be switched so they match the label. It was correct in Expected screenshot. |
I worked around it.
Cheers, yes they are switched |
This is pretty much done for now and I will close it for now. We need to kinda re-visit this topic over time again and will create issues when needed |
Background: In #7131 and #4734 we want to allow plugins to define a new type (eg Website, Mobile App, Server, ...). Types will be able to rename and to remove/add reports.
Problem 1: We have many pages in Piwik that display multiple reports in one page. They usually define the name of the report hard coded in the twig template such as in https://github.com/piwik/piwik/blob/2.13.0-rc3/plugins/VisitorInterest/templates/index.twig#L3 . This is not good as the name could have been changed by a plugin from eg
Visits by days since last visit
toSessions by days since last session
Problem 2: All reports that should be displayed are hard coded in twig templates and controller eg https://github.com/piwik/piwik/blob/2.13.0-rc3/plugins/VisitorInterest/templates/index.twig#L3 and https://github.com/piwik/piwik/blob/2.13.0-rc3/plugins/VisitorInterest/Controller.php#L21-L26 . If some reports are disabled by a type, they would be still rendered and displayed. Instead only the actual enabled reports should be displayed.
Problem 3: Links to such a page are hard coded in the
Menu
class like this: https://github.com/piwik/piwik/blob/2.13.0-rc3/plugins/VisitFrequency/Menu.php#L17 There is no way for us to find out whether all reports within that page are disabled or not. Eg if all reports within that page are disabled, we should not display this link in the menu. There would be a way for a plugin to disable that menu item by using the translation key of the menu name but this is no good. It is hard to find the translation key to use and the key could change; and another plugin does not know which plugins are displayed in that page (this can change over time) etc.In some cases a report class defines a
$menuTitle
causing it to be displayed in the menu. When such a report is disabled by a type, the menuTitle will not appear in the reporting menu which is good.Goals:
$name
of the$report
instanceMenu::configureReportingMenu
. The reporting menu should be built based on top of the API output of whatever composes those pagesThis will also help us make report pages look and feel more "similar".
Out of scope:
There are many ways to solve this. Ideally, we would generate the pages etc based on the reporting metadata. It could be as well a new API. This API / layout information could be interesting for Piwik Mobile as well.
As we want to render everything in the frontend anyway (long term), we could fetch the reports metadata (layout) via ajax and render the layouts (not the report itself) + reporting menu via angularjs.
Pages might be the wrong word, on a phone it is eg a "Screen". What would be a good name for eg an API method
API.getReportPages
? Or do we have to adjustAPI.getReportMetadata
(might be hard since pages != report)Maybe we can decouple pages and reports. Eg a report says it belongs to a category Visits, subcategory Devices. A subcategory devices decides what layout to use (and maybe also adds a report?) ... maybe rather not.
Ideas?
The text was updated successfully, but these errors were encountered: