Introduces an ajax endpoint for recording multiple stats at once.
Adds ~cookie-based~ localSorage-based unique stat recording.
Removes logging of stats in the backend. Reason is that pages can be cached.
Notes:
Caveat: this will not work if JS is disabled. Maybe something we should think about.
This is not a comprehensive solution for all the different stat use cases we want to cover, but contains the kernels of a solution.
The general idea of stats being a declarative key-value thing seems appealing and close to how wpjm does things in other places like e.g. forms, or how wp rest api declares endpoints. Also it is easy to extend and refactor, without a class explosion.
Deriving a stat's unique key should probably be a callback in the future. This is also somethihg that can be handled in this declarative stat style by having certain definition elements accept/be callbacks.
We might want to optimize inserts, but we can do that later.
Any better idea for the js cookie funcs? (Edit: we used localStorage instead)
Testing Instructions
Visit a job listing page.
Check that one view and one unique view are added to the db.
Refresh.
Check that unique view is not incremented.
Delete cookie. Refresh.
Check that one view and one unique view are added to the db.
Release Notes
New or Updated Hooks and Templates
*
Deprecated Code
*
Screenshot / Video
Plugin build for 83ba197ee2e960b1c48f5af9d788d27de8504fee
Fixes #2731
Changes Proposed in this Pull Request
Notes:
Testing Instructions
Release Notes
New or Updated Hooks and Templates
*
Deprecated Code
*
Screenshot / Video