MediaCG
MediaCG / Plugins / Readrank

Readrank

Most-read posts from your Google Analytics 4 data via Site Kit — accurate with page caching. Weekly top, views column and a slider widget.

Description

Counting views on the server does not work behind a full-page cache or a CDN. Readrank takes page views from your Google Analytics 4 property through Site Kit by Google and stores them in post meta every few hours.

  • Weekly top: views for the last N days (7 by default) for posts published within them — use the meta field to sort theme blocks («Order by: custom meta key»).
  • Views since publishing for posts of the last M days (60) — a sortable «Views» column in the posts list and the widget.
  • Widget «Readrank: Most read»: a slider with full titles (never cut), numbers, category label, autoplay, keyboard and swipe; categories chosen with checkboxes.
  • Status page with the last update, the top 3 of the week and errors, plus «Refresh now».
  • Clears the cached front page (WP Rocket) when the weekly top 3 changes.
  • No save_post on updates, so social-sharing or push plugins are not triggered.

Requires Site Kit by Google with Google Analytics 4 connected.

External services

Readrank requests reports from Google Analytics 4 through the Site Kit by Google plugin you already use (page paths and their view counts for the selected period). No visitor data is sent anywhere. Google Analytics terms: https://marketingplatform.google.com/about/analytics/terms/us/ · Privacy: https://policies.google.com/privacy

Reports API

Site reports for any period over the WordPress REST API, for external dashboards (Basic auth with an Application Password). Access: users who can edit_posts, or any role given the capability readrank_api. Dates are site dates (YYYY-MM-DD); every answer has data_until — the last day with complete data (GA4 is 1–2 days late, Search Console 2–3) — and cached.

  • GET /wp-json/readrank/v1/report/pages?start=&end=&page=1&per_page=500&orderby=views|clicks&path_prefix= — every page with GA4 views, users, average session duration (s), bounce rate (0–1) and Search Console clicks, impressions, CTR (0–1), position; merged by path (no query string or fragment, the site's trailing slash); pages found in only one source come with the other block null; post_id when the path is a post.
  • GET /wp-json/readrank/v1/report/totals?start=&end=&group=day|week|month — views, users, clicks, impressions per day, ISO week (from Monday) or month, plus sum (users deduplicated over the whole period).
  • GET /wp-json/readrank/v1/report/queries?url=|post_id=&start=&end=&limit=100 — Search Console queries of one page.

Each call asks Google at most once per source; a period's page list is fetched whole (Site Kit has no paging) and cached, so further pages are free. Cache: 1 h for periods within the last 3 days, 6 h otherwise; fresh=1 refetches (at most once a minute). Errors are HTTP 4xx/5xx with a code: bad_date, bad_period, bad_url, missing_url, post_not_found (400/404), sitekit_inactive, ga_not_connected, sc_not_connected (424), ga_error, sc_error (502). Only aggregates, no personal data.

Installation

  1. Install and connect Site Kit by Google with Analytics.
  2. Activate Readrank; open MCG Plugins → Readrank and click «Refresh now».
  3. Add the «Readrank: Most read» widget, or sort theme blocks by the weekly meta field.

Changelog

1.4.0 (2026-10-17)

  • Reports API for external dashboards (cDash): /readrank/v1/report/pages, /report/totals, /report/queries — GA4 and Search Console for any period through the Site Kit connection Readrank already uses, merged by page, cached, with data_until and clear error codes. Access: edit_posts or the capability readrank_api.
  • Filter readrank_pre_sitekit_data to supply data without Site Kit (tests).

1.3.2 (2026-10-16)

  • «Most read» widget: the photo fills its frame also when Imagify or another WebP plugin wraps it in <picture> (the class rr-img moves to <picture>); before, the photo dropped to the bottom under a grey strip. Hover zoom works in both cases.

1.3.1 (2026-10-15)

  • The «MCG Plugins» menu is now at the top of the admin menu, right under the Dashboard.
Older versions (4)

1.3.0 (2026-10-12)

  • Updates now come from the MEDIA CONTENT GROUP update server (mediacg.org): new versions show up in Plugins → Updates like any other plugin, with «View details» and auto-updates.
  • Plugin URI and Author URI point to mediacg.org.

1.2.0

  • Page stats in the admin bar (for editors, on the site): all-time views, users, engagement, today / 7 / 28 days, first and best day, a chart (days, weeks or months), sources, channels and devices from Google Analytics; impressions, clicks, CTR, position, chart and top queries from Search Console. Loaded on demand, cached per page.
  • «Stats» link in the posts list.
  • Site Kit requests fall back to the Analytics owner if a module owner's Google login stops working.

1.1.0 (2026-10-06)

  • Dashboard widget «Readrank — top of the week» with views bars.

1.0.0 (2026-10-06)

  • First release (from the in-house «top of the week» and «most read» modules of proslav.info).

Versions

Version
1.4.0 (current)
1.3.2
1.3.1
1.3.0

The plugins update themselves on every site: a new version shows up in Dashboard → Updates within ~12 hours, or right after «Check again».

For now the plugins run only on MediaCG and partner websites and are not distributed publicly. Interested in a plugin? Write to [email protected].