Este plugin no se ha probado con las últimas 3 versiones mayores de WordPress. Puede que ya no tenga soporte ni lo mantenga nadie, o puede que tenga problemas de compatibilidad cuando se usa con las versiones más recientes de WordPress.

DCO Insert Analytics Code

Descripción

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

Utilización

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

Configurar

  • Before </head> code
  • After <body> code
  • Before </body> 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 </head>

dco_iac_insert_before_head_show

Filter to change show the code is inserted before </head>

dco_iac_insert_after_body

Filter to change the code is inserted after <body>

dco_iac_insert_after_body_show

Filter to change show the code is inserted after <body>

dco_iac_insert_before_body

Filter to change the code is inserted before </body>

dco_iac_insert_before_body_show

Filter to change show the code is inserted before </body>

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> -->',
        'before_head_show' => '0',
        'after_body' => '<!-- after <body> -->',
        'after_body_show' => '1',
        'before_body' => '<!-- before </body> -->',
        'before_body_show' => '2'
    );

    return $array;
}

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

Change before </head> code

/*
* $code - value from "before </head>" setting
*/

function custom_before_head_code( $code ) {
    return $code . '<!-- before <head> -->' . "\n";
}

add_filter( 'dco_iac_insert_before_head', 'custom_before_head_code' );

Change before </body> code show

/*
* $value - value from "before </body> 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');

Capturas

  • Configurar page
  • Example page

Instalación

  1. Upload dco-insert-analytics-code folder to the /wp-content/plugins/ directory
  2. Activa el plugin desde el menú ‘Plugins’ de WordPress

FAQ

I put the code on the plugin settings page, but it does not appear on the site. What could be the reason?

Reseñas

3 de abril de 2021
Very light plugin that will make editing theme parts unnecessary. * header.php * footer.php Safe! No possibility to break things, can be used by newbies. Suitable for anything. * counters, analytics code * site verification with <meta> tags * adding loading additional scripts and styles or using them inline. * much more.
8 de agosto de 2019 1 respuesta
Не хватает поддержки мультисайтовости. Очень просим
10 de mayo de 2019
Allows precise insertion of code at many template locations. Light, simply and works well! Thank you.
Leer todas las 8 reseñas

Colaboradores y desarrolladores

«DCO Insert Analytics Code» es un software de código abierto. Las siguientes personas han colaborado con este plugin.

Colaboradores

«DCO Insert Analytics Code» está traducido en 2 idiomas. Gracias a los traductores por sus contribuciones.

Traduce «DCO Insert Analytics Code» a tu idioma.

¿Interesado en el desarrollo?

Revisa el código , echa un vistazo al repositorio SVN o suscríbete al registro de desarrollo por RSS.

Registro de cambios

1.1.3

  • Add settings link to Plugins page
  • Correct plugin description

1.1.2

  • Constant DCO_IAC_DO_SHORTCODE replaced with dco_iac_disable_do_shortcode filter. Use add_filter('dco_iac_disable_do_shortcode', '__return_true'); to disable shortcodes support.

1.1.1

  • Added feature to hide the code
  • Added shortcodes support (add constant define('DCO_IAC_DO_SHORTCODE', false); to wp-config.php for disable)

1.1.0

  • Fixed Text Domain
  • Added the ability to adjust the show code for logged / not logged users
  • Restricted direct access to plugin files

1.0.0

  • Lanzamiento inicial