Title: Headless GA4
Author: jakubkanna
Published: <strong>2026 年 4 月 13 日</strong>
Last modified: 2026 年 4 月 13 日

---

搜尋外掛

![](https://s.w.org/plugins/geopattern-icon/headless-ga4.svg)

# Headless GA4

 由 [jakubkanna](https://profiles.wordpress.org/jakubkanna/) 開發

[下載](https://downloads.wordpress.org/plugin/headless-ga4.0.1.1.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/headless-ga4/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/headless-ga4/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/headless-ga4/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/headless-ga4/#developers)

 [技術支援](https://wordpress.org/support/plugin/headless-ga4/)

## 外掛說明

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

## 安裝方式

 1. Upload the `headless-ga4` folder to `/wp-content/plugins/`.
 2. Activate the plugin through the WordPress Plugins screen.
 3. Go to `Settings > Headless GA4`.
 4. Enter your GA4 property ID.
 5. Paste your service account JSON credentials.
 6. Save the settings.
 7. Use the `Test connection` button.
 8. Open the main Dashboard screen to view the widget.

## 常見問題集

### 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?

 1.  Create a Google Cloud project.
 2.  In Google Cloud Console, open `APIs & Services`, click `Enable APIs and Services`,
     search for `Google Analytics Data API`, open it, and click `Enable`.
 3.  Create a service account.
 4.  Open the service account, go to `Keys`, click `Add key`, choose `Create new key`,
     then select `JSON` and download the file.
 5.  Copy the service account email address.
 6.  In GA4, open `Admin`, then `Property access management`, add that service account
     email, and grant it `Viewer` access.
 7.  In GA4, open `Admin`, then `Property settings`, and copy the numeric `Property
     ID`.
 8.  Paste the property ID and the full service account JSON into the plugin settings.
 9.  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

## 使用者評論

這個外掛目前沒有任何使用者評論。

## 參與者及開發者

以下人員參與了開源軟體〈Headless GA4〉的開發相關工作。

參與者

 *   [ jakubkanna ](https://profiles.wordpress.org/jakubkanna/)

[將〈Headless GA4〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/headless-ga4)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/headless-ga4/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/headless-ga4/)，或透過 [RSS](https://plugins.trac.wordpress.org/log/headless-ga4/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/headless-ga4/)。

## 變更記錄

#### 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

## 中繼資料

 *  版本 **0.1.1**
 *  最後更新 **2 個月前**
 *  啟用安裝數 **少於 10 次**
 *  WordPress 版本需求 ** 6.4 或更新版本 **
 *  已測試相容的 WordPress 版本 **6.9.4**
 *  PHP 版本需求 ** 7.4 或更新版本 **
 *  語言
 * [English (US)](https://wordpress.org/plugins/headless-ga4/)
 * 標籤:
 * [admin](https://tw.wordpress.org/plugins/tags/admin/)[analytics](https://tw.wordpress.org/plugins/tags/analytics/)
   [dashboard](https://tw.wordpress.org/plugins/tags/dashboard/)[ga4](https://tw.wordpress.org/plugins/tags/ga4/)
   [headless](https://tw.wordpress.org/plugins/tags/headless/)
 *  [進階檢視](https://tw.wordpress.org/plugins/headless-ga4/advanced/)

## 評分

這個項目尚無任何評論記錄。

[Your review](https://wordpress.org/support/plugin/headless-ga4/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/headless-ga4/reviews/)

## 參與者

 *   [ jakubkanna ](https://profiles.wordpress.org/jakubkanna/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/headless-ga4/)