Skip to main content

Read the Analytics Dashboard Listener Support donations

Premium Intermediate

Listener Support donations for the shows in view, per bucket of the growth series and in total, one series per currency: what the Analytics screen draws as Donations bars on its growth chart and as the Donations card in its tier breakdown. It takes show_id, date_from, date_to, scope and the growth route’s optional interval, with the same permission, 403 and 400 as the other Analytics Dashboard routes; a tier_slug is ignored. The add-on reads core only through benecaster_get_listener_support_donations().

  • buckets are the growth route’s for the same range and interval, so points[i] sits on the growth series’ buckets[i].
  • count and points[].count include every donation, in any currency or none; each currency’s count only its own. A donation with no amount or currency is in unpriced: count it, never add it as zero.
  • Use decimals to format, and *_minor for exact sums.
  • Label them donations received, never revenue: refunds are not recorded for donations and there is no test-mode flag.
  • available is the only “Listener Support is on” signal there is: whether any show read had a donation in the range.
  • The filter’s $args are show_ids, date_from, date_to, tier_slug (always null) and interval; a non-array return is ignored.

Code

const url = window.benecasterAnalyticsDashboard.apiUrl + 'analytics/donations?show_id=12&date_from=2026-10-01&date_to=2026-10-31';
const donations = await ( await fetch( url, { headers: { 'X-WP-Nonce': window.benecasterAdmin.nonce } } ) ).json();
if ( ! donations.available ) {
    // No donation in these dates for any show read.
}
// donations.count → 5, donations.unpriced → 1 (counted, in no currency)
for ( const c of donations.currencies ) {          // never add c.total across entries
    // c → { currency: 'USD', decimals: 2, count: 2, total_minor: 750, total: 7.5, points: [ { count: 1, amount_minor: 500, amount: 5 }, … ] }
}

View on GitHub →

Hooks Used

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