前言介紹
- 這款 WordPress 外掛「Analytics Head」是 2011-06-17 上架。
- 目前有 900 個安裝啟用數。
- 上一次更新是 2022-01-20,距離現在已有 1199 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 5.0 以上版本才可以安裝。
- 有 1 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
tools | google | script | analytics | webmaster |
內容簡介
這個外掛為你的WordPress網站增加Google Analytics的追蹤碼。與其他外掛不同的是,這個追蹤碼被加入到
區塊,因此你可以在Google網站管理員工具中授權你的網站。有很多針對WordPress的Google Analytics外掛可供使用。我自己使用過其中的一些,並且效果很好。問題在於當我想使用Google網站管理員工具時開始出現問題。
結果證明,我可以使用我的Google Analytics帳戶驗證網站的擁有權。問題在哪裡呢?Google網站管理員工具希望該代碼位於
區塊,而所有的外掛都將其放置在頁面的結尾處(除了這個外掛 - 這樣做是非常正確的)。因此,我創建了一個名為“Analytics Head”的外掛,將追蹤代碼放置在Web頁面的
區塊中。當然,如果你喜歡,你隨時可以將其放置在頁腳中。要求
此外掛需要安裝WordPress 4.0(請不要忘記更新WP安裝!)和PHP 5.3。提供先前版本的PHP相當不常見,但我必須提一下。
範例
這裡有一些開發人員的例子
操作
add_action( 'pp_google_analytics_head_before', function() {
echo '' . PHP_EOL;
$of_course = '我不必在這裡列印,我可以做其他事情!';
} );
add_action( 'pp_google_analytics_head_after', function() {
$i_just = '列印Google代碼...';
} );
過濾器
add_filter( 'pp_google_analytics_head_output', function( $s ) {
return str_replace( 'Google Analytics', 'Doodle Analytics', $s );
} );
原文外掛簡介
This plugin adds tracking code for Google Analytics to your WordPress site. Unlike other plugins, code is added to the
section, so you can authorize your site in Google Webmaster Tools.There are many Google Analytics plugins for WordPress. I used a few of those myself and it worked well. The trouble began when I willed to use Google Webmaster’s Tools.
It turned out that I can authenticate the ownership of the website using my Google Analytics account. Where’s the catch? Google Webmaster’s Tools expects that the code will be located at the section and all the plugs have placed it at the very end of the page (apart from this case – very rightly).
Therefore, I created a plug-in called “Analytics Head”, which places tracking code in the section of the web page. Of course you can put it in the footer at any moment, if you like.
Requirements
This plugin requires WordPress 4.0 (never forget to update your WP installation!) and PHP 5.3 installed on your server. It is pretty uncommon to offer previous versions of the PHP, however I must note that.
Examples
Here are a few examples for developers
Actions
add_action( 'pp_google_analytics_head_before', function() {
echo '' . PHP_EOL;
$of_course = 'I do not have to print here, I may do something else!';
} );
add_action( 'pp_google_analytics_head_after', function() {
$i_just = 'printed google code...';
} );
Filter
add_filter( 'pp_google_analytics_head_output', function( $s ) {
return str_replace( 'Google Analytics', 'Doodle Analytics', $s );
} );
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Analytics Head」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
0.6 | 0.5.1 | 0.5.2 | 0.5.3 | 0.5.4 | 0.5.5 | 0.5.6 | 1.5.0 | 1.5.1 | 1.5.2 | 1.5.3 | 1.6.0 | 1.6.1 | 1.6.2 | 1.6.3 | 1.6.4 | 1.6.5 | 1.6.6 | 1.6.7 | trunk | 1.4.4.1 | 1.5.4.0 |
延伸相關外掛(你可能也想知道)
Head & Footer Code 》Head & Footer Code 插件可以讓你在不是開發人員的情況下,添加自定義代碼片段(JavaScript、CSS 或 HTML)到網頁中。您可以將代碼放置在 (...。
LuckyWP Scripts Control 》「LuckyWP Scripts Control」外掛允許您將自訂代碼插入和管理網站。例如,您可以插入 Google Analytics 代碼、Google Search Console 驗證元標記、Facebook ...。
Unfiltered MU 》Unfiltered MU 提供給管理者和編輯者 unfiltered_html 功能。這可避免 WordPress MU/WordPress 3.0 多站點從這些使用者的文章中刪除