[WordPress] 外掛分享: Tracking Code for Google Tag Manager

首頁外掛目錄 › Tracking Code for Google Tag Manager
WordPress 外掛 Tracking Code for Google Tag Manager 的封面圖片
20+
安裝啟用
★★★★★
5/5 分(1 則評價)
623 天前
最後更新
問題解決
WordPress 5.2+ PHP 5.6+ v1.0.0 上架:2020-11-27

內容簡介

Tracking Code For Google Tag Manager 是一個簡單、輕量級的 WordPress 外掛程式,用於插入 Google Tag Manager 追蹤碼。這個外掛只會做一件事情,就是將標準的 Google Tag Manager 追蹤腳本列印到網站的 <head> 中。要插入您的容器 ID,請前往「設定」>「一般」,然後捲動頁面到底部。

Composer
composer require claytoncollie/tracking-code-for-google-tag-manager

篩選器

如果您想要在不使用 wp-admin 使用者介面的情況下設定容器 ID,可以使用下面的篩選器。

add_filter(
'tracking_code_for_google_tag_manager_id',
/**
* 設定 Google Tag Manager 容器 ID。
*
* @param string $container_id 容器 ID。
*
* @return string
*/
function ( $container_id ) {
return 'GTM-7654321';
}
);

貢獻

儘管這個外掛的目的是非常嚴格的,但歡迎問題和拉取請求,但我不保證所有的部分都會合併或支援。

https://github.com/claytoncollie/tracking-code-for-google-tag-manager

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Tracking Code for Google Tag Manager」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Tracking Code For Google Tag Manager is a simple, lightweight WordPress plugin for inserting your Google Tag Manager tracking code. The plugin does one thing and one thing only; prints the standard Google Tag Manager tacking script to the of your website. To insert your container ID, navigate to Settings > General and then scroll to the bottom of the page.
Composer
composer require claytoncollie/tracking-code-for-google-tag-manager

Filters
If you want to set the container ID without using the wp-admin user interface, use the filter below.
add_filter(
'tracking_code_for_google_tag_manager_id',
/**
* Set Google Tag Manager container ID.
*
* @param string $container_id Container ID.
*
* @return string
*/
function ( $container_id ) {
return 'GTM-7654321';
}
);

Contributing
While the purpose of this plugin is to be very tightly scoped, issues and pull requests are welcome, but I do not guarantee that everything will be merged or support will be given.
https://github.com/claytoncollie/tracking-code-for-google-tag-manager

延伸相關外掛

文章
Filter
Apply Filters
Mastodon