Description
Headless GA4 adds a compact Google Analytics 4 widget to the main WordPress dashboard.
It is designed for sites where:
- the frontend is not rendered by WordPress
- GA4 tracking already happens on the frontend
- WordPress only needs to read and display GA4 reporting data for admins
The plugin uses the Google Analytics Data API and a Google service account. It does not inject frontend tracking code.
Features:
- settings page for GA4 configuration
- dashboard widget with core traffic metrics
- last 7 days trend chart
- top pages and top traffic sources
- transient caching
- manual refresh action
Privacy
Headless GA4 does not track visitors or inject analytics scripts.
The plugin only sends server-side requests to Google when an administrator configures a GA4 property and opens the dashboard or tests the connection. Those requests use the service account credentials you provide in the plugin settings.
External services
This plugin connects to Google services to authenticate requests and fetch Google Analytics 4 report data. These requests are only made after an administrator configures the plugin and then opens the dashboard widget, refreshes the data, or uses the Test connection button.
Google OAuth token service (`oauth2.googleapis.com`)
Used to exchange the configured Google service account credentials for a short-lived access token.
Data sent: a signed JWT assertion containing the service account email, requested scope, token endpoint, issued-at time, and expiration time.
Terms of service: https://developers.google.com/terms
Privacy policy: https://policies.google.com/privacy
Google Analytics Data API (`analyticsdata.googleapis.com`)
Used to request GA4 report data for the configured GA4 property.
Data sent: the GA4 property ID, report request parameters such as date ranges, dimensions, metrics, and limits, plus the OAuth access token in the request headers.
Terms of service: https://developers.google.com/terms
Privacy policy: https://policies.google.com/privacy
Installation
- Upload the
headless-ga4folder to/wp-content/plugins/. - Activate the plugin through the WordPress Plugins screen.
- Go to
Settings > Headless GA4. - Enter your GA4 property ID.
- Paste your service account JSON credentials.
- Save the settings.
- Use the
Test connectionbutton. - Open the main Dashboard screen to view the widget.
FAQ
-
What is a service account?
-
A service account is a Google Cloud machine identity used by the plugin to read your GA4 reporting data without requiring a human Google login inside wp-admin.
-
Does this plugin install tracking on my site?
-
No. This plugin only reads GA4 report data. Your frontend must already send data to GA4.
-
What do I need from Google?
-
You need:
- a Google Cloud project
- the Google Analytics Data API enabled
- a service account
- the full service account JSON credentials
- Viewer access for that service account email in your GA4 property
- your GA4 numeric property ID
-
How do I set it up?
-
- Create a Google Cloud project.
- In Google Cloud Console, open
APIs & Services, clickEnable APIs and Services, search forGoogle Analytics Data API, open it, and clickEnable. - Create a service account.
- Open the service account, go to
Keys, clickAdd key, chooseCreate new key, then selectJSONand download the file. - Copy the service account email address.
- In GA4, open
Admin, thenProperty access management, add that service account email, and grant itVieweraccess. - In GA4, open
Admin, thenProperty settings, and copy the numericProperty ID. - Paste the property ID and the full service account JSON into the plugin settings.
- Save the settings and test the connection.
-
Why do I not see any data?
-
Possible reasons:
- the frontend is not sending GA4 events
- the wrong property ID was entered
- the service account email was not added in
GA4 > Admin > Property access management - the service account JSON is invalid
- the property has not received enough recent traffic
Reviews
There are no reviews for this plugin.
Contributors & Developers
“Headless GA4” adalah perisian sumber terbuka. Orang-orang berikut telah menyumbang kepada pemalam ini.
PenyumbangTranslate “Headless GA4” into your language.
Berminat dalam pembangunan?
Layari kod, periksa repositori SVN, atau langgani log pembangunan dengan RSS.
Changelog
0.1.1
- Replace inline admin CSS with an enqueued stylesheet
- Move admin screen markup into template files
- Remove deprecated OpenSSL cleanup call
- Add external service disclosures for Google services
0.1.0
- Initial release
- Settings page with service account configuration
- Dashboard widget with traffic summary
- GA4 Data API integration using a service account