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>
1.1.3
After installation and activation, you can insert the necessary code to the respective fields on the plugin settings page.
Filter for hardcoding override plugin settings. You won't be able to edit them on the settings page anymore when using this filter.
Filter to change the code is inserted before </head>
Filter to change show the code is inserted before </head>
Filter to change the code is inserted after <body>
Filter to change show the code is inserted after <body>
Filter to change the code is inserted before </body>
Filter to change show the code is inserted before </body>
Filter to disable shortcode processing in inserted codes
/*
* $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);
/*
* $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' );
/*
* $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' );
add_filter('dco_iac_disable_do_shortcode', '__return_true');
- Add settings link to Plugins page
- Correct plugin description
- 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.
- Added feature to hide the code
- Added shortcodes support (add constant define('DCO_IAC_DO_SHORTCODE', false); to wp-config.php for disable)
- Fixed Text Domain
- Added the ability to adjust the show code for logged / not logged users
- Restricted direct access to plugin files
- Initial Release