EMIANO Analytics Ranking

Beskriuwing

EMIANO Analytics Ranking shows your most viewed posts, using the page view data that Google Analytics 4 (GA4) has already collected for your site. It does not count views on your server, so it adds no tracking code and no database writes on page views.

The plugin connects to GA4 with a Google Cloud service account. It retrieves page views in the background on a schedule, matches each page path to a post on your site, and stores the ranking. Visitors only see the stored ranking, so displaying it does not call Google.

Features

  • Rankings for up to five periods, chosen from 12 hours, 1 day, 3 days, 1 week, 1 month, 3 months, and 6 months. Each period is counted back from the current time.
  • Automatic retrieval: every hour for 12 hours and 1 day, every 6 hours for 3 days and 1 week, and once a day for longer periods.
  • “Analytics Ranking” block and [emiano_ranking] shortcode. Each one shows up to ten posts for one period and one post type.
  • Display options for the whole site: thumbnail, rank number, post date, and the date and time of the last ranking update. Posts without a featured image show an empty frame of the same size.
  • Optional title above the ranking: set the text, the tag (H1 to H6, p, or div), and class names. A class showing the period is added automatically.
  • Optional text to show when there is no ranking data yet.
  • Views of the same post under different URLs are combined. Old URLs recorded by WordPress after a slug change are also matched to the post.
  • Works with both pretty permalinks and the Plain permalink structure (/?p=123).
  • Only published posts are shown. Pages are not included.
  • Retrieval status for each period on the settings screen: last successful retrieval, result, error type, and next retrieval.
  • When you change the property ID or the key, the plugin asks whether to retrieve the data again right away.
  • The ranking uses your theme’s colors and fonts. The plugin only sets the layout and spacing.

Shortcode

[emiano_ranking period="1w" post_type="post"]
  • period: one of the periods selected on the settings screen (12h, 1d, 3d, 1w, 1m, 3m, 6m). If omitted, the shortest selected period is used.
  • post_type: one public post type. Default: post.

If a period that is not selected on the settings screen is specified, the shortcode shows the same output as when there is no data.

About GA4 data

GA4 usually needs 2 to 6 hours before recent page views are available through its API, and the numbers can change for 24 to 48 hours after that. The most recent views therefore appear in the ranking after a delay.

External services

This plugin connects to the following Google services to retrieve your GA4 data. Requests are made only after you save a property ID and a service account key. They are sent from your server, not from your visitors’ browsers. No information about your visitors is sent.

Google OAuth 2.0 token service

Used to obtain a short-lived access token for the service account.
Endpoint: https://oauth2.googleapis.com/token
Data sent: a JSON Web Token signed on your server with the service account private key. It contains the service account email address, the read-only Analytics scope, the token endpoint as the audience, and the time it was issued and expires. The private key itself is never sent.
When: when an access token is needed for the requests below. The token is cached until shortly before it expires.

Google Analytics Admin API

Used to read the time zone of your GA4 property, so that periods are counted in the property’s time zone.
Endpoint: https://analyticsadmin.googleapis.com/
Data sent: the property ID and the access token.
When: before retrieving page views, at most once a day per property (the time zone is cached).

Google Analytics Data API

Used to retrieve page views per page path for the selected periods.
Endpoint: https://analyticsdata.googleapis.com/
Data sent: the property ID, the access token, and the report request (date range, page path dimension, page view metric, sort order, and row limit).
When: on the automatic schedule described above, when you choose to retrieve data again after changing the settings, and when you use “Test connection”.

Google APIs Terms of Service: https://developers.google.com/terms
Google Privacy Policy: https://policies.google.com/privacy

Blokken

Dizze plugin jout 1 blok.

  • Analytics Ranking Show popular posts ranked by page views.

Ynstallaasje

  1. Install and activate the plugin.
  2. In Google Cloud, create or choose a project and enable both the “Google Analytics Data API” and the “Google Analytics Admin API”.
  3. In the same project, create a service account. No Google Cloud role is needed. Open the service account, go to Keys, choose Add key > Create new key > JSON, and download the key file.
  4. In Google Analytics, open Admin > Property access management for your GA4 property and add the service account email address with the Viewer role.
  5. In Google Analytics, open Admin > Property details and copy the numeric property ID. Do not use the measurement ID that starts with “G-“.
  6. In WordPress, open Settings > Analytics Ranking. Enter the property ID, paste the contents of the key file, choose the periods, and save.
  7. Use “Test connection” to check the settings.
  8. Add the “Analytics Ranking” block or the [emiano_ranking] shortcode to a post, page, or widget area.

If another EMIANO plugin is active, the settings screen is under the EMIANO menu instead of Settings.

FAQ

Do I need to add a tracking code?

No. The plugin uses the data that your GA4 property already collects. GA4 itself must be installed on your site separately.

Why does the ranking not show my latest views?

GA4 makes recent data available through its API after a delay of usually 2 to 6 hours, and the plugin retrieves data on a schedule. See “About GA4 data” above.

Why is the ranking empty?

Check the retrieval status on the settings screen. Rankings appear after the first successful retrieval. The plugin uses WP-Cron, which runs when your site receives visits. Also check that the ranking’s period is selected on the settings screen.

The settings screen says “Check the property ID, and make sure the service account is added…”

Google returns the same error when the property ID is wrong and when the service account has no access to the property. Check both.

How is the service account key stored?

The key is saved in your site’s database, in the emiano_ar_settings option, which is not autoloaded and is not exposed through the REST API. It is never displayed again after saving; the settings screen shows only the service account email address. Leave the key field empty to keep the saved key. Use a service account that only has the Viewer role on the GA4 property.

Does it work with the Plain permalink structure?

Yes. With Plain permalinks, the plugin asks GA4 for the page path including the query string (for example /?p=123) and matches it to the post.

Are private or password-protected posts shown?

Private posts, drafts, scheduled posts, and trashed posts are never shown. A post that is made private after retrieval is hidden immediately. Password-protected posts are shown with their protected title, in the same way as WordPress post lists.

What is removed when I delete the plugin?

The settings (including the service account key), the stored rankings, the retrieval status, the cached access token and time zone, and the scheduled events.

Resinsjes

D’r binne gjin resinsjes foar dizze plugin.

Meiwurkers & amp; Untwikkelders

“EMIANO Analytics Ranking” is iepen boarne software. De folgjende minsken hawwe bydroegen oan dizze plugin.

Meiwurkers

Oersette “EMIANO Analytics Ranking” yn jo taal.

Ynteressearre yn ûntwikkeling?

Blêdzje troch de koade , besjoch de SVN-repository , of abonnearje op it ûntwikkelingslogboek troch RSS .

Feroaringslog

1.0.0

  • Initial release.