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
Refactor tracker code so tracking code that handles request parameters can be organized by plugins #8071
Comments
Sounds very good. Why do the |
The current logic (all in The third method exists because inserting custom logs has to be done after visits are handled. So recording actions is done after a visit, and recording conversions after the visit. I don't want to change existing tracker behaviour in any way, just reorganize it. |
+1 for the general idea to move more logic from Tracker core into the plugins. I really hope we can make it happen for 3.0.0! |
Thanks for the explanation. Regarding the fact that this interface will be implemented by plugins, it might make sense to make it an abstract class instead (to allow a little more flexibility later to add new methods)? |
Abstract class sounds ok to me :) |
done in #8223 |
Refs #8071, refactor tracker code for clarity, modularity and so plugins can have more granular control over tracking. Introduce RequestProcessor & request metadata concepts & use to split up Visit::handle() method so tracking logic is located in the relevant plugins.
@diosmosis after we make it API (or some of it), can you please check the developer guides cover this new official ways of extending Tracker? https://github.com/piwik/developer-documentation/pull/100/files |
Part of the issue was done, the rest is "wontfix" until we need it. Likely we'll refactor these Tracker APIs in a later major Piwik version |
The purpose of this issue is to refactor the tracker so code relevant to plugins (eg, goal/conversion tracking, action tracking, etc.) are put into their respective plugins (eg, Goals, Actions).
To accomplish this, we can refactor
Visit::handle()
and introduce a new concept of aRequestProcessor
which plugins implement to handle tracker request parameters. Unlike dimensions, these parameters do not have to be stored in the DB, and unlike Handlers, these parameters do not require an entirely different tracking mechanism (ie, QueuedTracking).TODO:
introduce a new RequestProcessor interface which plugins implement (and add to DI). has the following methods:
use the RequestProcessors in Visit::handle() as follows:
move goal tracking code to Goals plugin & move action tracking code to Actions plugin
Move ping=1 tracker handling to a new plugin. When doing so, make sure ping=1 will ignore all goal related logic to be faster.
Move Action class & related code to Actions plugin. Move GoalManager to Goals plugin. Move other plugin related code to plugins from core.
Move current code to insert/update visit data in core to CoreHome. To do this correctly, would need a new service (eg, VisitRecorder), so VisitRequestProcessor does not get bloated (or more bloated).
Remove lots of tracking events, I think many (if not most) are no longer needed.
Create a new method in RequestProcessor specifically for manipulating request metadata. Right now,
afterRequestProcessed()
is used for both defining metadata that depends on other plugins' metadata and for manipulating other plugins' metadata. This means metadata that uses other plugins' metadata, can't be manipulated. Order of plugins will be come a problem eventually if many plugins get involved together...Refactor the system again for clarity and ease of use. This makes it possible to split up the code and correctly scope classes, but the code is still verbose and the tracking logic is still not obvious. Before the system is made
@api
it should be made as easy to use as possible.After it is possible to inject "component" types, RequestProcessors should use the "component" scheme.
Decouple VisitorRecognizer from Tracker classes and add integration test for it.
Do not use multi-dimensional array of properties for request metadata, instead use array of classes defined by plugins, so:
The text was updated successfully, but these errors were encountered: