[WordPress] 外掛分享: DCO Insert Analytics Code

前言介紹

  • 這款 WordPress 外掛「DCO Insert Analytics Code」是 2016-01-15 上架。
  • 目前有 5000 個安裝啟用數。
  • 上一次更新是 2021-07-28,距離現在已有 1375 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 4.6 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 5.3 以上。
  • 有 8 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

denisco |

外掛標籤

metrika | analytics | yandex metrica | google analytics |

內容簡介

DCO Insert Analytics Code 是一個 WordPress 外掛,旨在於在 之前、 之後或 之前插入分析代碼(或任何自訂代碼)。

使用方法

在安裝和啟用後,您可以在外掛設置頁面的相應欄位中插入必要的代碼。
GitHub

設置

在 之前的代碼
在 之後的代碼
在 之前的代碼

過濾器列表

dco_iac_get_options

用於硬編碼覆蓋外掛設置的過濾器。使用此過濾器時,您將無法在設置頁面上編輯它們。

dco_iac_insert_before_head

用於更改代碼在 之前插入的過濾器。

dco_iac_insert_before_head_show

用於更改插入代碼在 之前顯示的過濾器。

dco_iac_insert_after_body

用於更改代碼在 之後插入的過濾器。

dco_iac_insert_after_body_show

用於更改插入代碼在 之後顯示的過濾器。

dco_iac_insert_before_body

用於更改代碼在 之前插入的過濾器。

dco_iac_insert_before_body_show

用於更改插入代碼在 之前顯示的過濾器。

dco_iac_disable_do_shortcode

用於禁用插入代碼中的短碼處理的過濾器。

過濾器使用示例

硬編碼覆蓋外掛設置

/*
* $current - 當前外掛設置
*
* $options - 來自數據庫的外掛設置
*
* $default - 默認外掛設置
*/

function custom_get_options($current, $options, $default) {
$array = array(
'before_head' => '',
'before_head_show' => '0',
'after_body' => '',
'after_body_show' => '1',
'before_body' => '',
'before_body_show' => '2'
);

return $array;
}

add_filter('dco_iac_get_options', 'custom_get_options', 10, 3);

更改在 之前的代碼

/*
* $code - 來自 "before " 設置的值
*/

function custom_before_head_code( $code ) {
return $code . '' . "\n";
}

add_filter( 'dco_iac_insert_before_head', 'custom_before_head_code' );

更改在 之前的代碼顯示

/*
* $value - 來自 "before show" 設置的值
*/

function custom_before_head_code( $value ) {
return '2';
}

add_filter( 'dco_iac_insert_before_body_show', 'custom_before_body_show' );

禁用插入代碼中的短碼處理

add_filter('dco_iac_disable_do_shortcode', '__return_true');

原文外掛簡介

DCO Insert Analytics Code is a WordPress plugin is intended for insert analytics code(or any custom code) before or after

or before
Usage
After installation and activation, you can insert the necessary code to the respective fields on the plugin settings page.
GitHub
Settings

Before code
After

code
Before code

Filters list
dco_iac_get_options
Filter for hardcoding override plugin settings. You won’t be able to edit them on the settings page anymore when using this filter.
dco_iac_insert_before_head
Filter to change the code is inserted before
dco_iac_insert_before_head_show
Filter to change show the code is inserted before
dco_iac_insert_after_body
Filter to change the code is inserted after


dco_iac_insert_after_body_show
Filter to change show the code is inserted after
dco_iac_insert_before_body
Filter to change the code is inserted before
dco_iac_insert_before_body_show
Filter to change show the code is inserted before
dco_iac_disable_do_shortcode
Filter to disable shortcode processing in inserted codes
Examples of using filters
Hardcoding override plugin settings
/*
* $current - current plugin settings
*
* $options - plugin settings from database
*
* $default - default plugin settings
*/

function custom_get_options($current, $options, $default) {
$array = array(
'before_head' => '',
'before_head_show' => '0',
'after_body' => '',
'after_body_show' => '1',
'before_body' => '',
'before_body_show' => '2'
);

return $array;
}

add_filter('dco_iac_get_options', 'custom_get_options', 10, 3);

Change before code
/*
* $code - value from "before " setting
*/

function custom_before_head_code( $code ) {
return $code . '' . "\n";
}

add_filter( 'dco_iac_insert_before_head', 'custom_before_head_code' );

Change before

code show
/*
* $value - value from "before show" setting
*/

function custom_before_head_code( $value ) {
return '2';
}

add_filter( 'dco_iac_insert_before_body_show', 'custom_before_body_show' );

Disable shortcode processing in insert codes
add_filter('dco_iac_disable_do_shortcode', '__return_true');

各版本下載點

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0.0 | 1.1.0 | 1.1.1 | 1.1.2 | 1.1.3 | trunk |

延伸相關外掛(你可能也想知道)

文章
Filter
Apply Filters
Mastodon