[Simple Analytics] Subscriber Change Over Time Chart & Mailchimp API Integration#206
Open
iamdharmesh wants to merge 11 commits intofeature/data-layer-and-form-event-trackingfrom
Open
[Simple Analytics] Subscriber Change Over Time Chart & Mailchimp API Integration#206iamdharmesh wants to merge 11 commits intofeature/data-layer-and-form-event-trackingfrom
iamdharmesh wants to merge 11 commits intofeature/data-layer-and-form-event-trackingfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new “Subscriber change over time” analytics section (bar + doughnut charts) backed by a new admin AJAX endpoint that fetches Mailchimp list activity and aggregates it for charting.
Changes:
- Register a new backend data provider (
Mailchimp_Subscriber_Activity) and hook an admin AJAX action for subscriber activity. - Add new Analytics admin template markup for the subscriber activity card (states, charts, totals).
- Extend the analytics JS/CSS to fetch and render the diverging bar chart + totals doughnut, and update styling via SCSS.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| mailchimp.php | Boots the new subscriber activity provider class. |
| includes/class-mailchimp-subscriber-activity.php | New AJAX endpoint + caching + date-range filtering/aggregation for Mailchimp activity data. |
| includes/admin/templates/analytics.php | Adds subscriber activity section markup; adjusts deep link button styling. |
| assets/js/analytics.js | Adds subscriber activity module (Chart.js rendering) and introduces WP i18n usage. |
| assets/css/analytics.scss | New SCSS-based styling for analytics page and subscriber activity card. |
| assets/css/analytics.css | Removes the previously committed compiled CSS source file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
The PR adds a Subscriber change over time section on the Analytics admin page, a diverging bar chart (new subscribers vs unsubscribes) and a totals doughnut with net change, driven by the Mailchimp Marketing API
lists/{list_id}/activityendpoint. The section loads on the existingmailchimp-analytics-refreshevent so it stays independent from KPIs and Form Performance section failures in this request do not block other analytics UI.Technical Details:
Backend:
Mailchimp_Subscriber_Activityclass (includes/class-mailchimp-subscriber-activity.php): admin AJAX actionmailchimp_sf_get_subscriber_activity, capability check (MCSF_CAP_THRESHOLD), nonce (mailchimp_sf_analytics_admin_nonce), and validatedlist_id/date_from/date_to(Y-m-d).limited: truewhen the selected span exceeds what Mailchimp can supply so the UI can show an info notice.mailchimp_sf_subscriber_activity_+ hash) so one cache entry serves many date-range requests.init()’d frommailchimp.phpnext to existing analytics classes.Frontend:
includes/admin/templates/analytics.php: new card markup for the section (title, date subtitle, notice, chart + totals, loading/error/empty states). Strings use themailchimptext domain.assets/js/analytics.js: subscribes to filter refresh, POSTs toadmin-ajax.php, renders Chart.js bar (diverging: positive new subs, negative unsubs) and doughnut for range totals; handles empty, error, and limited-range notice.assets/css/analytics.scss(and builtdist/assets vianpm run build): layout (chart + totals column), legend, notice/error/loading states, responsive behavior.Closes #200
How to test the Change
Changelog Entry
Credits
Props @iamdharmesh @builtbytay April Domingo Cameron Campbell
Checklist: