{"id":41326,"date":"2016-01-16T01:17:34","date_gmt":"2016-01-16T01:17:34","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/dco-insert-analytics-code\/"},"modified":"2021-07-28T12:29:11","modified_gmt":"2021-07-28T12:29:11","slug":"dco-insert-analytics-code","status":"publish","type":"plugin","link":"https:\/\/he.wordpress.org\/plugins\/dco-insert-analytics-code\/","author":14326752,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.1.3","stable_tag":"1.1.3","tested":"5.8.13","requires":"4.6","requires_php":"5.3","requires_plugins":"","header_name":"DCO Insert Analytics Code","header_author":"Denis Yanchevskiy","header_description":"","assets_banners_color":"","last_updated":"2021-07-28 12:29:11","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"http:\/\/denisco.pro","rating":5,"author_block_rating":0,"active_installs":4000,"downloads":38606,"num_ratings":8,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0.0":{"tag":"1.0.0","author":"denisco","date":"2016-04-18 22:06:37"},"1.1.0":{"tag":"1.1.0","author":"denisco","date":"2017-12-04 00:27:08"},"1.1.1":{"tag":"1.1.1","author":"denisco","date":"2018-01-14 00:26:53"},"1.1.2":{"tag":"1.1.2","author":"denisco","date":"2018-01-19 20:03:07"},"1.1.3":{"tag":"1.1.3","author":"denisco","date":"2021-07-28 12:29:11"}},"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":8},"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":1806013,"resolution":"128x128","location":"assets","locale":""},"icon-256x256.png":{"filename":"icon-256x256.png","revision":1806013,"resolution":"256x256","location":"assets","locale":""},"icon.svg":{"filename":"icon.svg","revision":1806013,"resolution":false,"location":"assets","locale":false}},"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.0","1.1.0","1.1.1","1.1.2","1.1.3"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":1968460,"resolution":"1","location":"assets","locale":""},"screenshot-2.png":{"filename":"screenshot-2.png","revision":1570765,"resolution":"2","location":"assets","locale":""}},"screenshots":{"1":"Settings page","2":"Example page"},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[232,1005,20562,22924],"plugin_category":[36],"plugin_contributors":[86329],"plugin_business_model":[],"class_list":["post-41326","plugin","type-plugin","status-publish","hentry","plugin_tags-analytics","plugin_tags-google-analytics","plugin_tags-metrika","plugin_tags-yandex-metrica","plugin_category-analytics","plugin_contributors-denisco","plugin_committers-denisco"],"banners":[],"icons":{"svg":"https:\/\/ps.w.org\/dco-insert-analytics-code\/assets\/icon.svg?rev=1806013","icon":"https:\/\/ps.w.org\/dco-insert-analytics-code\/assets\/icon.svg?rev=1806013","icon_2x":false,"generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/dco-insert-analytics-code\/assets\/screenshot-1.png?rev=1968460","caption":"\u05d0\u05e4\u05e9\u05e8\u05d5\u05d9\u05d5\u05ea page"},{"src":"https:\/\/ps.w.org\/dco-insert-analytics-code\/assets\/screenshot-2.png?rev=1570765","caption":"Example page"}],"raw_content":"<!--section=description-->\n<p>DCO Insert Analytics Code is a WordPress plugin is intended for insert analytics code(or any custom code) before &lt;\/head&gt; or after &lt;body&gt; or before &lt;\/body&gt;<\/p>\n\n<h4>Usage<\/h4>\n\n<p>After installation and activation, you can insert the necessary code to the respective fields on the plugin settings page.\n<a href=\"https:\/\/github.com\/yadenis\/DCO-Insert-Analytics-Code\">GitHub<\/a><\/p>\n\n<h4>Settings<\/h4>\n\n<ul>\n<li>Before &lt;\/head&gt; code<\/li>\n<li>After &lt;body&gt; code<\/li>\n<li>Before &lt;\/body&gt; code<\/li>\n<\/ul>\n\n<h4>Filters list<\/h4>\n\n<p><strong>dco_iac_get_options<\/strong><\/p>\n\n<p>Filter for hardcoding override plugin settings. You won't be able to edit them on the settings page anymore when using this filter.<\/p>\n\n<p><strong>dco_iac_insert_before_head<\/strong><\/p>\n\n<p>Filter to change the code is inserted before &lt;\/head&gt;<\/p>\n\n<p><strong>dco_iac_insert_before_head_show<\/strong><\/p>\n\n<p>Filter to change show the code is inserted before &lt;\/head&gt;<\/p>\n\n<p><strong>dco_iac_insert_after_body<\/strong><\/p>\n\n<p>Filter to change the code is inserted after &lt;body&gt;<\/p>\n\n<p><strong>dco_iac_insert_after_body_show<\/strong><\/p>\n\n<p>Filter to change show the code is inserted after &lt;body&gt;<\/p>\n\n<p><strong>dco_iac_insert_before_body<\/strong><\/p>\n\n<p>Filter to change the code is inserted before &lt;\/body&gt;<\/p>\n\n<p><strong>dco_iac_insert_before_body_show<\/strong><\/p>\n\n<p>Filter to change show the code is inserted before &lt;\/body&gt;<\/p>\n\n<p><strong>dco_iac_disable_do_shortcode<\/strong><\/p>\n\n<p>Filter to disable shortcode processing in inserted codes<\/p>\n\n<h4>Examples of using filters<\/h4>\n\n<p><strong>Hardcoding override plugin settings<\/strong><\/p>\n\n<pre><code>\/*\n* $current - current plugin settings\n*\n* $options - plugin settings from database\n*\n* $default - default plugin settings\n*\/\n\nfunction custom_get_options($current, $options, $default) {\n    $array = array(\n        'before_head' =&gt; '&lt;!-- before &lt;\/head&gt; --&gt;',\n        'before_head_show' =&gt; '0',\n        'after_body' =&gt; '&lt;!-- after &lt;body&gt; --&gt;',\n        'after_body_show' =&gt; '1',\n        'before_body' =&gt; '&lt;!-- before &lt;\/body&gt; --&gt;',\n        'before_body_show' =&gt; '2'\n    );\n\n    return $array;\n}\n\nadd_filter('dco_iac_get_options', 'custom_get_options', 10, 3);\n<\/code><\/pre>\n\n<p><strong>Change before &lt;\/head&gt; code<\/strong><\/p>\n\n<pre><code>\/*\n* $code - value from \"before &lt;\/head&gt;\" setting\n*\/\n\nfunction custom_before_head_code( $code ) {\n    return $code . '&lt;!-- before &lt;head&gt; --&gt;' . \"\\n\";\n}\n\nadd_filter( 'dco_iac_insert_before_head', 'custom_before_head_code' );\n<\/code><\/pre>\n\n<p><strong>Change before &lt;\/body&gt; code show<\/strong><\/p>\n\n<pre><code>\/*\n* $value - value from \"before &lt;\/body&gt; show\" setting\n*\/\n\nfunction custom_before_head_code( $value ) {\n    return '2';\n}\n\nadd_filter( 'dco_iac_insert_before_body_show', 'custom_before_body_show' );\n<\/code><\/pre>\n\n<p><strong>Disable shortcode processing in insert codes<\/strong><\/p>\n\n<pre><code>add_filter('dco_iac_disable_do_shortcode', '__return_true');\n<\/code><\/pre>\n\n<!--section=installation-->\n<ol>\n<li>Upload <code>dco-insert-analytics-code<\/code> folder to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id='i%20put%20the%20code%20on%20the%20plugin%20settings%20page%2C%20but%20it%20does%20not%20appear%20on%20the%20site.%20what%20could%20be%20the%20reason%3F'><h3>I put the code on the plugin settings page, but it does not appear on the site. What could be the reason?<\/h3><\/dt>\n<dd><ul>\n<li>For correct work plugin your theme must support <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_head\/\">wp_head action hook<\/a> and <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_footer\/\">wp_footer action hook<\/a>.<\/li>\n<li>If you are using plugins for caching you need to clear the cache to apply the changes.<\/li>\n<\/ul><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.1.3<\/h4>\n\n<ul>\n<li>Add settings link to Plugins page<\/li>\n<li>Correct plugin description<\/li>\n<\/ul>\n\n<h4>1.1.2<\/h4>\n\n<ul>\n<li>Constant <code>DCO_IAC_DO_SHORTCODE<\/code> replaced with <code>dco_iac_disable_do_shortcode<\/code> filter. Use <code>add_filter('dco_iac_disable_do_shortcode', '__return_true');<\/code> to disable shortcodes support.<\/li>\n<\/ul>\n\n<h4>1.1.1<\/h4>\n\n<ul>\n<li>Added feature to hide the code<\/li>\n<li>Added shortcodes support (add constant <code>define('DCO_IAC_DO_SHORTCODE', false);<\/code> to wp-config.php for disable)<\/li>\n<\/ul>\n\n<h4>1.1.0<\/h4>\n\n<ul>\n<li>Fixed Text Domain<\/li>\n<li>Added the ability to adjust the show code for logged \/ not logged users<\/li>\n<li>Restricted direct access to plugin files<\/li>\n<\/ul>\n\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial Release<\/li>\n<\/ul>","raw_excerpt":"Allows you to insert analytics code before &lt;\/head&gt; or after &lt;body&gt; or before &lt;\/body&gt;","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/he.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/41326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/he.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/he.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/he.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=41326"}],"author":[{"embeddable":true,"href":"https:\/\/he.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/denisco"}],"wp:attachment":[{"href":"https:\/\/he.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=41326"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/he.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=41326"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/he.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=41326"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/he.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=41326"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/he.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=41326"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/he.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=41326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}