Skip to main content

Read Outlinks’ link-click totals by channel over REST, as the Analytics screen’s Link clicks box does

Premium Intermediate Outlinks

With Analytics Dashboard also on, Outlinks adds a Link clicks box to the Analytics screen. These are the two routes behind it. Both take date_from and date_to (UTC Y-m-d, both inclusive, required) and need manage_options with the REST nonce.

Both answer 200 { total, by_referrer: { page, rss, email, other }, links: [ { id, slug, label, clicks } ], link_count }: human clicks only, links the ten most-clicked (most first, then by slug), link_count every link clicked in the dates. They are built on benecaster_outlinks_count_clicks(), so the figures always agree with it; from PHP, call that function instead.

  • GET /benecaster-outlinks/v1/shows/{show_id}/clicks — one show. 403 benecaster_outlinks_not_active where Outlinks is off for the show.
  • GET /benecaster-outlinks/v1/clicks — every show where Outlinks and Analytics Dashboard are both on (the Analytics screen’s All my shows). 403 benecaster_outlinks_not_active while Outlinks is off for every show.
  • 400 benecaster_outlinks_date_invalid (data.field date_from or date_to) for a date that is not a real Y-m-d day, or an end before the start.

Site-wide links (those with no show) are never in either.

Code

<?php
const url = `${ wpApiSettings.root }benecaster-outlinks/v1/shows/${ showId }/clicks?date_from=2026-11-01&date_to=2026-11-30`;
const summary = await fetch( url, { headers: { 'X-WP-Nonce': wpApiSettings.nonce }, credentials: 'same-origin' } ).then( ( r ) => r.json() );
// summary.by_referrer.rss: clicks from podcast apps, through the feed's show notes.

View on GitHub →

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