Designed 2 Use...

Cheshire Web Development

07810 640 239

  • Home
  • About
  • App Development
  • Scripts
  • Basket
  • Contact

GA Views

Show real Google Analytics 4 pageview counts on your posts — without slowing your site down

Designed2Use GA Views displays the GA4 pageview total for any post or page with a simple shortcode. The point of difference is *how* it fetches those numbers: a visitor’s page load is never held up waiting on Google’s slow Analytics API.

Download from WordPress.org

Built properly: a hybrid fetch model

Most “view counter” plugins either call the Analytics API on every page load (slow, and it counts against your API quota) or store everything and drift out of date. This one does neither:

  • Fresh value cached? It’s served instantly.
  • Recent post, cache expired? The count is fetched live with a short, fail-fast timeout over a narrow date window (the post’s publish date to today) —  fast, because the query is small.
  • Older post, cache expired? The last known value is shown immediately and a background WP-Cron job refreshes it off the request path. The heavy, history-spanning query never runs while a visitor waits.

The result: accurate GA4 numbers, with page-load performance that doesn’t depend on Google responding quickly.

Features

  • Simple shortcode — drop `

    1 Views

    ` into a post, page, or template.
  • Or automatic display — append the count to post content, or article header, with no shortcode required.
  • Full settings page — service-account credentials, GA4 Property ID, live-fetch window, cache duration, display label, metric, event name, and which post types are tracked.
  • Legacy baseline — optionally add historical (e.g. Universal Analytics) views to the live GA4 count on a per-post basis, so totals stay continuous.
  • Lightweight & self-contained — talks to the GA4 Data API directly over REST using a self-signed service-account token. No bundled multi-megabyte SDK.

Privacy & security

  • The only external service contacted is Google’s GA4 Data API, using your own service-account credentials. No telemetry, no phone-home.
  • All output is escaped; all writes are nonce- and capability-protected.
  • For higher security you can keep your key out of the database entirely by defining `D2UGAV_CREDENTIALS_JSON` or `D2UGAV_CREDENTIALS_PATH` in `wp-config.php`.

Google Analytics is a third-party service governed by Google’s Privacy Policy and the Google Analytics Terms of Service.

Requirements

  • WordPress 6.0 or later
  • PHP 7.4 or later
  • A Google Cloud service account with Viewer access to your GA4 property

Getting started

1. Install and activate the plugin (search “Designed2Use GA Views” in Plugins → Add New, or download from WordPress.org).

2. In Google Cloud, create a service account, grant it Viewer access to your GA4 property, and download its JSON key.

3. Go to Settings → GA Views, paste the JSON, enter your numeric GA4 Property ID, and save.

4. Add `

1 Views

` where you want the count, or switch on automatic display.

1 Views

Contact me on 07810 640 239 or on [email protected]

© Designed 2 Use a web development company based in Cheshire, UK
Part of The John Hulme Partnership Ltd

We are using cookies to give you the best experience on our website.

You can find out more about which cookies we are using or switch them off in .

Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

Cookie Policy

More information about our Cookie Policy

Powered by  GDPR Cookie Compliance