Skip to main content

Read the Analytics Dashboard feed health history

Premium Intermediate Analytics Dashboard

What Benecaster’s nightly check found in each show’s public feed, one entry per UTC day of the range, as the Feed health panel, its Export CSV and the PDF snapshot draw it. It takes show_id, date_from, date_to (inclusive UTC Y-m-d) and scope, with the same permission and 403 as the other Analytics Dashboard routes; a tier_slug is ignored, since the public feed has no tier. The add-on reads each show through benecaster_get_feed_health_history(), never the table.

  • state: 'unchecked' is a night the check did not run (WP-Cron needs a site visit). Every figure of that day is null. Never draw it as valid or invalid, and never carry the day before into it.
  • first_checked is the first day with a record, null for none. History begins the night a site first ran the check, and Settings → Tools → Analytics data retention prunes it, so an unchecked start can be either; say both.
  • syncs is whether any day of the range has sync figures. Without it, sync_runs and sync_failures are null on every day and in totals: the show does not sync from an external feed, which is not 0.
  • first_error_code is Benecaster’s untranslated code, compile_failed when the feed could not be built, or null when valid. first_error_label and each problem’s label are the translated sentence; a code the add-on does not know reads The feed failed a check (<code>) with known: false. problems groups the invalid days by code, most days first.
  • With scope=all each show where the add-on is active is read on its own, one entry per show.
  • The filter’s $args are show_ids, date_from, date_to and tier_slug (always null); a non-array return is ignored. It runs for the panel, the CSV, the PDF and the digest alike.
  • Digests. The weekly and monthly digests add a feed_health section, titled Feed health, only when something went wrong in the period: an invalid day, or a failed sync run. On its own it makes a digest worth sending. benecaster_analytics_digest_data’s feed_health key is null otherwise, and always in the daily digest; when set it is {days, checked, invalid, unchecked, sync_runs, sync_failures, problem}.

Code

const url = window.benecasterAnalyticsDashboard.apiUrl + 'analytics/feed-health?show_id=12&date_from=2026-09-01&date_to=2026-09-14';
const health = await ( await fetch( url, { headers: { 'X-WP-Nonce': window.benecasterAdmin.nonce } } ) ).json();
// health.shows[0] → { show_id: 12, show_name: 'Night Shift', syncs: true, first_checked: '2026-09-01', last_checked: '2026-09-14',
//   totals: { days: 14, checked: 11, valid: 7, invalid: 4, unchecked: 3, sync_runs: 43, sync_failures: 3 },
//   problems: [ { code: 'item_duration_invalid', label: 'An episode’s duration is not written as hours, minutes and seconds', known: true, days: 2, last_day: '2026-09-05' }, … ],
//   days: [ { date: '2026-09-01', state: 'valid', error_count: 0, first_error_code: null, first_error_label: null,
//             episode_count: 12, feed_size_bytes: 48000, sync_runs: 4, sync_failures: 0, checked_at: '2026-09-02 00:15:00' }, … ] }

View on GitHub →

Hooks Used

Need this built rather than just documented? See our services →