
前言介紹
- 這款 WordPress 外掛「Pagemetrics for Matomo」是 2025-11-17 上架。
- 目前尚無安裝啟用數,是個很新的外掛。如有要安裝使用,建議多測試確保功能沒問題!
- 上一次更新是 2025-11-18,距離現在已有 100 天。
- 外掛最低要求 WordPress 6.1 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 8.1 以上。
- 尚未有人給過這款外掛評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
matomo | privacy | tracking | analytics | server side |
內容簡介
### 總結:
Pagemetrics for Matomo 透過 pagemachine/matomo-tracking PHP library 將隱私友好的伺服器端分析功能加入 WordPress。啟用後,外掛直接將來自 WordPress 網站的頁面視圖和可選的下載事件發送到 Matomo 實例,而不需載入 Matomo 的 JavaScript 追蹤器。主要好處包括追蹤頁面視圖、可選下載追蹤、多站點支持、尊重不要追蹤和全球隱私控制標頭,以及能夠記錄問題到 WordPress 偵錯日誌。
### 問題與答案:
- 頁面視圖和哪些屬性可以在伺服器端進行完全控制?
- 可以控制標題、URL 和引軌器等屬性。
- 什麼是 pm_matomo_tracking_should_track_request 鉤子的作用?
- 該鉤子的作用是返回 false 以跳過當前請求的追蹤。
- 如何判斷是否需要將特定 URL 重新寫入?
- 可以使用 pm_matomo_tracking_is_download_url 鉤子,它接收 URL 和預設擴展名列表,用於決定是否需要重新寫入特定 URL。
- 如何在重新寫入的下載 URLs 中附加校驗和資訊?
- 使用 pm_matomo_tracking_download_url 鉤子,應用檢查碼到已重新寫入的下載 URL。
原文外掛簡介
Pagemetrics for Matomo adds privacy-friendly, server-side analytics to WordPress by
leveraging the pagemachine/matomo-tracking PHP library. When enabled, the
plugin sends page view and optional download events from your WordPress site
directly to a Matomo instance without loading Matomo’s JavaScript tracker.
Key benefits:
Track page views on the server with full control over attributes such as title, URL and referrer.
Optional download tracking rewrites file links and records the click before redirecting visitors.
Multisite aware – network admins can define defaults, individual sites can override them.
Respects Do Not Track and Global Privacy Control headers through the underlying library.
Logs issues to the WordPress debug log when WP_DEBUG is enabled.
Looking for expert help with Matomo or server-side tracking? Pagemachine offers
consulting, implementation and ongoing support via our Pagemetrics solution.
More info: Pagemetrics.eu
Developer Hooks
pm_matomo_tracking_should_track_request — Return false to skip tracking for the current request.
pm_matomo_tracking_should_rewrite_downloads — Return false to keep original download URLs for the current post.
pm_matomo_tracking_is_download_url — Decide whether a specific URL should be rewritten (receives URL and default extension list).
pm_matomo_tracking_download_extensions — Adjust the list of file extensions that count as downloads.
pm_matomo_tracking_download_url — Customize the generated redirect URL used for download tracking.
pm_matomo_tracking_download_redirect_status — Change the HTTP status code used when redirecting to the original file.
pm_matomo_tracking_log_message — Listen to debug messages emitted while WP_DEBUG is enabled.
Example usages
// Skip tracking for administrators.
add_filter('pm_matomo_tracking_should_track_request', static function ($shouldTrack) {
return current_user_can('manage_options') ? false : $shouldTrack;
});
// Keep original download URLs on the privacy policy page.
add_filter('pm_matomo_tracking_should_rewrite_downloads', static function ($shouldRewrite) {
return is_page('privacy-policy') ? false : $shouldRewrite;
});
// Force CDN assets to be treated as downloads.
add_filter('pm_matomo_tracking_is_download_url', static function ($decision, $url) {
return str_contains($url, 'cdn.example.com/assets/') ? true : $decision;
}, 10, 2);
// Add extra file types to download tracking.
add_filter('pm_matomo_tracking_download_extensions', static function ($extensions) {
$extensions = array_merge($extensions, ['svg', 'heic']);
return array_unique($extensions);
});
// Append a checksum to rewritten download URLs.
add_filter('pm_matomo_tracking_download_url', static function ($trackingUrl, $target, $label) {
$checksum = substr(hash('sha256', $target . $label), 0, 12);
return add_query_arg('pm_checksum', $checksum, $trackingUrl);
}, 10, 3);
// Use a 307 redirect instead of the default 302.
add_filter('pm_matomo_tracking_download_redirect_status', static function () {
return 307;
});
// Forward debug messages to the PHP error log while developing.
add_action('pm_matomo_tracking_log_message', static function ($level, $message) {
if (!defined('WP_DEBUG') || WP_DEBUG !== true) {
return;
}
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
error_log(sprintf('[Pagemetrics for Matomo][%s] %s', strtoupper((string) $level), $message));
}, 10, 2);
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Pagemetrics for Matomo」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
延伸相關外掛(你可能也想知道)
Tagging 》- AdPage Tagging 是一個簡單易用的解決方案,用於設置 Google Tag Manager 伺服器端。, - 標籤化的好處包括:, * 增加 Cookie 的生命周期(包括 Safari 16...。
schubwerk Tracking 》schubwerk Analytics 是一款符合歐盟一般資料保護法(GDPR)的伺服器端分析解決方案,用於追蹤網站流量。該外掛可以收集、分析訪客流量、會議數量和使用者行為...。
Pirsch Analytics 》Pirsch 是一個簡單、注重隱私、開源的網站分析工具。它輕盈且不使用 Cookie,在 WordPress 中易於整合,而且不使用 JavaScript。它不會收集可以唯一歸因於使...。
AJAX Manufactory 》當您計劃使用 AJAX 技術在 WordPress 上開發應用程序時,您必須解決許多與應用程序的邏輯無關的小問題:, , 如何打包和傳輸從瀏覽器到服務器的數據,以便它們...。Qreuz 》Qreuz 的 WordPress 官方外掛程序可以讓您訪問關於您的網站活動的免費同意數據。所有收集的數據都將由您100%擁有。原始數據訪問和導出可用。從您的 WordPress...。
