[WordPress] 外掛分享: Profenv – Environment Profiles

首頁外掛目錄 › Profenv – Environment Profiles
WordPress 外掛 Profenv – Environment Profiles 的封面圖片
全新外掛
安裝啟用
尚無評分
剛更新
最後更新
問題解決
WordPress 5.5+ PHP 7.4+ v0.7.0 上架:2026-07-16

內容簡介

Profenv 外掛可為每個環境(如生產、測試等)儲存特定的值(例如 GTM 容器 ID 和 GA4 測量 ID),並根據當前運行的環境自動切換,解決了生產設定無法在測試環境中重用的常見問題。

【主要功能】
• 四步驟環境檢測
• 環境特定值的自動輸出
• 支援 Google Tag Manager 和 Google Analytics 4
• 共享欄位定義與值
• 公開 API 供擴展與佈景主題使用

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.7.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Profenv – Environment Profiles」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Profenv stores environment-specific values (such as a GTM container ID and a GA4 measurement ID) for each of your environments (production, staging, and any additional sets) and switches them automatically based on the environment the site is currently running in. It solves the common migration problem where production settings cannot be reused on staging, and vice versa.

Four-step fallback environment detection: custom constant (wp-config.php), WP_ENVIRONMENT_TYPE (WP 5.5+), domain mapping, and undetermined as the last resort
When the environment cannot be determined, output of environment-specific values is suspended and a warning is shown in the admin screen. This prevents staging tags from ever firing on production
Field definitions (key and type, including code snippets) are shared across all environments, while each environment stores its own values
Each environment can also define environment-specific fields (key, type, and value) that exist only in that environment
When keys named gtm_id / ga4_id are defined and filled, the core plugin automatically outputs the GTM / GA4 tags with proper escaping; all other values are stored only and never output by the core plugin
Public API for extensions and themes: profenv_current_env(), profenv_get(), and profenv_get_all(), each with a filter equivalent that returns a safe default when the plugin is inactive
Shared field values are also readable through the standard option API — get_option( ‘profenv_gtm_id’ ) — and through ACF’s get_field() with the same prefixed name, always returning the current environment’s value
Extensions can register their own fields via the profenv_register_fields filter and reuse the settings infrastructure

External services
This plugin can connect to Google Tag Manager and Google Analytics 4, services provided by Google LLC. They are used to load the tag container / measurement snippet that the site administrator has configured. No connection is made at all unless you enter a GTM container ID and/or a GA4 measurement ID in the plugin settings.
When a GTM container ID is set, the standard Google Tag Manager snippet is output on every front-end page, and the visitor’s browser loads https://www.googletagmanager.com/gtm.js (plus https://www.googletagmanager.com/ns.html inside a noscript iframe). When a GA4 measurement ID is set, the standard Google tag (gtag.js) snippet is output, and the visitor’s browser loads https://www.googletagmanager.com/gtag/js. As a consequence of loading these scripts, the visitor’s IP address, user agent, and the URL of the visited page are transmitted to Google on every front-end page view, and Google may collect additional analytics data according to how your Tag Manager container or Analytics property is configured.
The plugin itself sends no data to Google; requests are made by the visitor’s browser only after you configure the IDs above. You are responsible for informing your visitors and obtaining any consent required in your jurisdiction (for example, via a consent management plugin).

Google Tag Manager: Use Policy, Privacy Policy
Google Analytics 4: Terms of Service, Privacy Policy

延伸相關外掛

文章
Filter
Apply Filters
Mastodon