Traffic Post Page Views
Show your most viewed posts as a block, widget, grid or slider.
Install in
Traffic Post Page Views shows visitors what is popular on your site. It counts how often each post is viewed and lists the most viewed posts as a block, a widget, a grid or a slider.
Choose where the counts come from:
- Built-in view counter: works right away, no Google account needed. It works with page caching, counts each visitor once per browser session and ignores bots.
- Google Analytics 4: connect your Google account and pick your GA4 property. View counts are fetched in the background on a schedule you choose, so your pages never wait for Google.
Features
- Popular Posts block for the block editor and Site Editor, with list, grid and slider layouts.
- Most viewed in the last 7 days, the last 30 days or all time.
- Popular Posts widget for classic sidebars.
- Shortcodes for any layout, plus the shortcodes from version 2.
- Lightweight slider with no jQuery. It supports swipe, keyboard and screen readers, and its optional autoplay respects “reduced motion”.
- Sortable Views column in the admin posts list and a Page views box on the edit screen.
- View counts in the REST API (
tapp_viewsfield on posts). - Works with posts, pages and custom post types.
- Optional GA4 tracking tag (gtag.js), if your site does not have one yet.
- Translation ready.
Shortcodes
[tapp_popular_posts number="5" period="30d" layout="grid" columns="3"]: any layout (list,grid,slider) and period (all,30d,7d). Other options:show_thumbnail,show_views,show_excerpt,show_date,post_type,exclude_current.[tapp_get_latest total_post="5"]: slider, using the slider settings.[tapp_get_latest_grid total_post="6"]: grid, using the grid settings.[tapp_views]: view count of the current post, or[tapp_views id="123"].
External services
This plugin can connect to Google services. Nothing is sent to Google unless an administrator sets it up.
Google Analytics 4 (optional data source). When an administrator chooses Google Analytics 4 and clicks “Connect with Google”:
- The administrator is sent to Google’s sign-in page (accounts.google.com) to allow read-only access to Google Analytics.
- The site exchanges the sign-in code and refreshes access tokens at oauth2.googleapis.com, and reads the e-mail address of the connected account from openidconnect.googleapis.com.
- The site lists the GA4 properties the account can read through the Google Analytics Admin API (analyticsadmin.googleapis.com).
- On the schedule the administrator chooses, and when “Sync now” is clicked, the site requests page view counts per page path from the Google Analytics Data API (analyticsdata.googleapis.com). Only the property ID, date ranges and the names of the requested fields are sent; no visitor data is sent.
- When the administrator clicks “Disconnect”, the access is revoked at oauth2.googleapis.com.
Google Analytics tracking tag (optional). If an administrator enters a GA4 measurement ID on the “Tracking code” tab, every page loads gtag.js from www.googletagmanager.com, and visitors’ browsers send page view data to Google Analytics.
These services are provided by Google: Terms of Service, Privacy Policy, Google APIs Terms of Service.
The built-in view counter does not use any external service. It only stores view counts in your WordPress database.
Written by Joobi from the project's own listing. See the source page
3.0.0
- New: Google Analytics 4 support. Version 2 used Universal Analytics, which Google switched off in 2024, so view counts could no longer be fetched.
- New: Built-in view counter that works without a Google account and with page caching.
- New: Popular Posts block with list, grid and slider layouts.
- New: Most viewed in the last 7 days, the last 30 days or all time (block, widget and shortcodes).
- New: [tapp_popular_posts] and [tapp_views] shortcodes.
- New: Page views box on the post edit screen and a tapp_views field in the REST API.
- New: Choose which post types are counted (posts, pages, custom post types).
- New: “Sync now” button and a sync status overview.
- Improvement: View counts are fetched from Google in the background with a few batched requests, instead of one request per post while pages load.
- Improvement: New slider without jQuery (swipe, keyboard and screen reader support), ready for jQuery 4 in WordPress 7.2.
- Improvement: The Popular Posts widget now has the period, featured image and view count options and uses the theme’s widget markup.
- Improvement: Shortcodes no longer depend on Bootstrap; the grid is responsive.
- Improvement: Removed about 400 KB of unused files (Bootstrap, jQuery UI, colour picker, bxSlider).
- Fix: Every front-end page stopped loading while the plugin was active (leftover debug code).
- Fix: Saved Google client ID and secret were erased when the settings were loaded.
- Fix: The slider shortcode printed its output in the wrong place on the page.
- Fix: The GA tracking tag was printed even when no ID was set.
- Security: The Google sign-in is protected with a one-time security code, and all settings actions check permissions and use nonces.
- Security: All output is escaped, and the tracking ID and slider sizes are validated.
- Compatibility: Tested with WordPress 7.2; compatible with PHP 7.4 to 8.4. Requires WordPress 6.5 and PHP 7.4 or later.
- Settings, widgets and shortcodes from version 2 are kept; a notice asks you to reconnect Google Analytics.
2.4.1
- Update Author & Contributor
2.4
- Update Author
2.3
- Compatibility check with WordPress 6.3
2.2
- Compatibility check with WordPress 6.3
2.1
- Minor UI changes
2.0
- Menu name change in admin side
1.0
- First version.
Follow this listing's changes (Atom feed)