-
Notifications
You must be signed in to change notification settings - Fork 83
Try: Fediverse Wrapped statistics feature #2633
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
base: trunk
Are you sure you want to change the base?
Conversation
Implements monthly/annual statistics collection and display: - Core Statistics class for collecting engagement metrics - Scheduler for monthly stats collection and annual compilation - Dashboard widget showing stats with charts - Annual email template for year-end summaries - Shareable wrapped card for public sharing Known issues: - URL rewrite rules for wrapped card need debugging (year parameter not captured) - Stats display shows 0 values on HTTP requests despite correct query var registration Related to #2597
Eliminated the Fediverse Wrapped shareable card functionality by deleting the template, removing related rewrite rules, query vars, and rendering logic from Statistics, and cleaning up associated JavaScript and dashboard UI elements.
- Replace jQuery-based widget with React components - Add REST API endpoint for statistics data - Add TypeScript types for stats data structures - Add chart legend showing engagement types - Support stored monthly stats for demo/historical data - Add CLI command for populating demo data (local dev only)
- Make StatHighlights display engagement types dynamically from API - Add period label "This month vs. last year" to clarify comparison - Draw individual lines for each engagement type in the chart - Use WordPress default color palette CSS variables with fallbacks - Remove hardcoded comment types - all types now dynamic - Move demo data generation from Statistics class to local CLI
obenland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping it to structure, I'd see if there are stats we can bump as they occur instead of aggregating monthly. I reckon that'll probably be more accurate, especially for things we can't or are hard to query after the fact.
One of the reasons Jetpack is so powerful is because it can store large amounts of data, process them remotely, and aggregate them. It might be worth considering making this a jetpack integration instead of hoping an option is enough?
The dashboard widget is neat, is there something we can do to make that a bit more interactive?
| ); | ||
|
|
||
| // Add inline script to initialize the widget. | ||
| $actors = self::get_available_actors(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should be able to get that on the JS side, like in the reader.
| * | ||
| * @return array Modified cron schedules. | ||
| */ | ||
| public static function add_cron_schedules( $schedules ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add_cron_schedules, register_schedules, deregister_schedules should live in Scheduler.
| */ | ||
| public static function init() { | ||
| \add_action( 'activitypub_collect_monthly_stats', array( self::class, 'collect_all_monthly_stats' ) ); | ||
| \add_action( 'activitypub_compile_annual_stats', array( self::class, 'compile_and_send_annual_stats' ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than sending it as an email, I'd create a landing page that can be shared. maybe we could even create a summary image or something?
The email should just link to the landing page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about a block, so that you can use it in a post and share that.
|
|
||
| // Schedule annual stats compilation for January 1st. | ||
| if ( ! \wp_next_scheduled( 'activitypub_compile_annual_stats' ) ) { | ||
| $next_year = self::get_next_january_first(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is still structural, but I'd send it on the first of December or in the first week of December.
That's when others send out those notifications, ready for the end of the year.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally yes, but I though maybe I can have a version out by januar ;)
|
@obenland thanks for your feedback! 🫶 |
I somehow agree, that we might be able to have a collab, but you checked the number of folks that have both installed an that is quite low. So I would love to have at least a basic stats feature in the plugin, to maybe motivate users to interact a bit more!? |
- Move cron schedule methods (add_cron_schedules, register_schedules, deregister_schedules) from Scheduler\Statistics to main Scheduler - Move helper methods (get_next_first_of_month, get_next_january_first) to main Scheduler - Update dashboard stats widget to get actors on JS side like the reader - Use @wordpress/core-data to check actor mode and capabilities - Remove PHP-passed actors from Statistics_Dashboard
Fixes #2597
Proposed changes:
Removed from original scope:
Other information:
Testing instructions:
Setup demo data (optional):
Dashboard Widget:
/wp-admin/)Clear demo data:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Add Fediverse statistics dashboard widget with engagement metrics and charts.