{"id":66,"date":"2019-07-18T12:16:30","date_gmt":"2019-07-18T11:16:30","guid":{"rendered":"https:\/\/organicdigital.co\/blog\/?p=66"},"modified":"2024-06-10T14:45:29","modified_gmt":"2024-06-10T13:45:29","slug":"how-to-implement-robots-noindex-tag-with-google-tag-manager","status":"publish","type":"post","link":"https:\/\/daveashworth.co\/blog\/how-to-implement-robots-noindex-tag-with-google-tag-manager\/","title":{"rendered":"How To: Implement Robots Noindex Tag With Google Tag Manager"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/daveashworth.co\/blog\/how-to-implement-robots-noindex-tag-with-google-tag-manager\/#The_Story_Behind_This_Case_Study\" >The Story Behind This Case Study<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/daveashworth.co\/blog\/how-to-implement-robots-noindex-tag-with-google-tag-manager\/#Real_Life_Case_Study\" >Real Life Case Study<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/daveashworth.co\/blog\/how-to-implement-robots-noindex-tag-with-google-tag-manager\/#How_To_Add_Custom_Scripts_Using_Google_Tag_Manager\" >How To Add Custom Scripts Using Google Tag Manager<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/daveashworth.co\/blog\/how-to-implement-robots-noindex-tag-with-google-tag-manager\/#Adding_Triggers_To_Fire_NoIndex_Tags\" >Adding Triggers To Fire NoIndex Tags<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/daveashworth.co\/blog\/how-to-implement-robots-noindex-tag-with-google-tag-manager\/#Testing_Your_Tags_and_Triggers\" >Testing Your Tags and Triggers<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/daveashworth.co\/blog\/how-to-implement-robots-noindex-tag-with-google-tag-manager\/#How_To_Check_The_Tag_Is_Live\" >How To Check The Tag Is Live<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/daveashworth.co\/blog\/how-to-implement-robots-noindex-tag-with-google-tag-manager\/#What_Next\" >What Next?<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_Story_Behind_This_Case_Study\"><\/span>The Story Behind This Case Study<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>As a <a href=\"https:\/\/daveashworth.co\/\">website optimisation consultant<\/a>, one of the things that is most important for me on a website is to have full control over the content that you allow Google to crawl and index.<\/p>\n\n\n\n<p>Whilst the modern-day website CMS generally offers a flexible approach to technical SEO on both a site and page level, you invariably face issues that prevent you from implementing various page elements to assist with your onsite SEO.<\/p>\n\n\n\n<p>For example, there are a number of instances where thin, low\nquality content is present on a site due to the inability to add the robots noindex\ntag, such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Search filter &amp; URL parameterised pages<\/li>\n\n\n\n<li>Paginated content<\/li>\n\n\n\n<li>Blog taxonomy and archive pages<\/li>\n<\/ul>\n\n\n\n<p>Whilst, in theory, the canonical tag can assist with the consolidation of such pages (which you can also <a href=\"https:\/\/daveashworth.co\/skills\/google-tag-manager-consultant\/\">add with Google Tag Manager<\/a>) it doesn\u2019t always have the desired effect and in my experience it\u2019s best to go ahead and noindex duplicate, near duplicate and thin content to enhance site quality and organic visibility \u2013 particularly if those pages target similar terms to key landing pages on the site.<\/p>\n\n\n\n<p>Some may see this as a maverick move, and it should be noted\nthat Google state <a href=\"https:\/\/www.seroundtable.com\/google-long-term-noindex-follow-24990.html\" target=\"_blank\" rel=\"noopener\">that\nif you add noindex to a page, eventually, the links will be nofollowed<\/a>, so\nif there are key pages linked to from pages you are setting to noindex, ensure\nthese are linked to from elsewhere within your site.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Real_Life_Case_Study\"><\/span><strong>Real Life Case Study<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To demonstrate how this works, I\u2019ll use my <a href=\"https:\/\/daveashworth.co\/contact\/\">contact page<\/a> as a guinea pig.&nbsp;&nbsp; At time of writing, it is in Google\u2019s index which can be checked using the \u201csite:\u201d search command:<\/p>\n\n\n\n<p><a href=\"https:\/\/www.google.com\/search?q=site%3Adaveashworth.co%2Fcontact%2F\">site:daveashworth.co\/contact\/<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"772\" height=\"354\" src=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/site-contact.png\" alt=\"site search command\" class=\"wp-image-68\" srcset=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/site-contact.png 772w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/site-contact-150x69.png 150w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/site-contact-300x138.png 300w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/site-contact-768x352.png 768w\" sizes=\"(max-width: 772px) 100vw, 772px\" \/><\/figure>\n\n\n\n<p>You can also use Google Search Console to check a page\u2019s\nindexed status:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"644\" height=\"423\" src=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/gsc-status.png\" alt=\"GSC Status\" class=\"wp-image-69\" srcset=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/gsc-status.png 644w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/gsc-status-150x99.png 150w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/gsc-status-300x197.png 300w\" sizes=\"(max-width: 644px) 100vw, 644px\" \/><\/figure>\n\n\n\n<p>When viewing the source code, you can see the robots index\ntag in place:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"544\" height=\"323\" src=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/view-source.png\" alt=\"Inspect Code\" class=\"wp-image-70\" srcset=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/view-source.png 544w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/view-source-150x89.png 150w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/view-source-300x178.png 300w\" sizes=\"(max-width: 544px) 100vw, 544px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_To_Add_Custom_Scripts_Using_Google_Tag_Manager\"><\/span><strong>How To Add Custom Scripts Using Google Tag Manager<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This article assumes Google Tag Manager is already in place\non your site, if not I would recommend <a href=\"https:\/\/support.google.com\/tagmanager\/answer\/6103696?hl=en\" target=\"_blank\" rel=\"noopener\">Google\u2019s\nSetup and Installation guide<\/a> as your starting point.<\/p>\n\n\n\n<p>The robots tag can be added using a \u201cCustom HTML\u201d tag which\nimplements the following script:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script&gt;\n\/\/ Removes any existing meta robots tag\njQuery('meta&#91;name=\"robots\"]').remove();\n\/\/ Create an empty meta element, called 'meta'\nvar meta = document.createElement('meta');\n\/\/ Add a name attribute to the meta, with the value 'robots'\nmeta.name = 'robots';\n\/\/ Add a content attribute to the meta element, with the value 'noindex, follow'\nmeta.content = 'noindex, follow';\n\/\/ Insert this meta element into the head of the page, using jQuery\njQuery('head').append(meta);\n&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<p>As you can see from the comments, this script will remove\nthe existing tag, create a new one, add the desired directive then append this\nto the meta section of your page:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"923\" height=\"515\" src=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/custom-html.png\" alt=\"Custom HTML\" class=\"wp-image-71\" srcset=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/custom-html.png 923w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/custom-html-150x84.png 150w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/custom-html-300x167.png 300w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/custom-html-768x429.png 768w\" sizes=\"(max-width: 923px) 100vw, 923px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Adding_Triggers_To_Fire_NoIndex_Tags\"><\/span><strong>Adding Triggers To Fire NoIndex Tags<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You then set up triggers which will determine on which pages\nthe tag is fired on.&nbsp; In this case, you select\na trigger type of \u201cDOM Ready\u201d. &nbsp;&nbsp;You can also use \u201cPage View\u201d, but I prefer \u201cDOM\nReady\u201d as, in simple terms, sometimes certain triggers will not fire if you use\npage view as the page hasn\u2019t been fully constructed.<\/p>\n\n\n\n<p>The next part is key \u2013 you must specify the conditions (in\nthis case the URLs) on which you want the tag to be implemented.&nbsp; You do this by setting \u201cThis trigger fires on\u201d\nto \u201cSome DOM Events\u201d.<\/p>\n\n\n\n<p>Do not, repeat, do not set this on \u201cAll DOM Ready Events\u201d as\nthis will add the tag to EVERY page on your site.<\/p>\n\n\n\n<p>Once selected, set the conditions to \u201cPage URL\u201d and then determine\nthe URL structure that matches which pages you want this to fire on.&nbsp; <\/p>\n\n\n\n<p>For example, if you wanted all pages within \/blog\/tags\/ to fire\nthis tag, you would set \u201ccontains\u201d and \u201c\/blog\/tags\/\u201d<\/p>\n\n\n\n<p>If you want to set this on specific pages, you can set \u201cequals\u201d and the full URL (and add multiple filters for multiple page). &nbsp;&nbsp;So for this example, we set \u201cequals\u201d to \u201chttps:\/\/daveashworth.co\/contact\/\u201d:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"922\" height=\"367\" src=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/trigger-configuration.png\" alt=\"Trigger Configuration\" class=\"wp-image-72\" srcset=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/trigger-configuration.png 922w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/trigger-configuration-150x60.png 150w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/trigger-configuration-300x119.png 300w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/trigger-configuration-768x306.png 768w\" sizes=\"(max-width: 922px) 100vw, 922px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Testing_Your_Tags_and_Triggers\"><\/span><strong>Testing Your Tags and Triggers<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>I cannot stress this enough, you must test your tags and\ntriggers to ensure they only fire on the desired pages.&nbsp; To do this, enter \u201cPreview\u201d mode within GTM,\nwhere you will then see the following message:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"790\" height=\"276\" src=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/preview-workspace.png\" alt=\"Preview Workspace\" class=\"wp-image-73\" srcset=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/preview-workspace.png 790w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/preview-workspace-150x52.png 150w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/preview-workspace-300x105.png 300w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/preview-workspace-768x268.png 768w\" sizes=\"(max-width: 790px) 100vw, 790px\" \/><\/figure>\n\n\n\n<p>You can then navigate your site in a separate tab to see which\ntags are, and aren\u2019t, being fired.<\/p>\n\n\n\n<p>If I now visit my home page, I can see the only tag being\nfired is a GA Page View, and the noindex tag lays dormant:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"533\" height=\"646\" src=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/noindex-nofire.png\" alt=\"NoIndex Tag Not Firing\" class=\"wp-image-74\" srcset=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/noindex-nofire.png 533w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/noindex-nofire-248x300.png 248w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/noindex-nofire-124x150.png 124w\" sizes=\"(max-width: 533px) 100vw, 533px\" \/><\/figure>\n\n\n\n<p>If I then navigate to the contact page, I can see that the\ntag is fired:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"685\" height=\"652\" src=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/noindex-firing.png\" alt=\"NoIndex Tag Firing\" class=\"wp-image-75\" srcset=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/noindex-firing.png 685w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/noindex-firing-150x143.png 150w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/noindex-firing-300x286.png 300w\" sizes=\"(max-width: 685px) 100vw, 685px\" \/><\/figure>\n\n\n\n<p>Once you have tested the arse of this across various pages\nand are happy that the tag only fires on the desired pages, publish your changes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_To_Check_The_Tag_Is_Live\"><\/span><strong>How To Check The Tag Is Live<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>It is important to note when reviewing source code to check your\nchanges you will not see this change if you simply \u201cview source\u201d.&nbsp; By default, this will show you unparsed code \u2013\nso in order to see your changes, you must use the \u201cInspect\u201d tool which will allow\nyou to see the fully parsed source code:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1024\" height=\"398\" src=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/inspect-source-code-1024x398.png\" alt=\"Inspecting Source Code\" class=\"wp-image-76\" srcset=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/inspect-source-code-1024x398.png 1024w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/inspect-source-code-150x58.png 150w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/inspect-source-code-300x117.png 300w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/inspect-source-code-768x299.png 768w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/07\/inspect-source-code.png 1345w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In time, your page will be crawled, parsed and de-indexed.&nbsp;&nbsp; To speed this process up, you can request a page be crawled via Google Search Console.<\/p>\n\n\n\n<p>It  should also be noted, this approach only works for search engines which render Javascipt, and as there can a gap between crawling and rendering, it is not a permanent replacement for the noindex tag.  But, you know, it works for Google, so, crack on and worry about Bing, Yahoo, Yandex and DuckDuckGo later.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Next\"><\/span><strong>What Next?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>That\u2019s it.&nbsp; Adding tags via GTM is a relatively straightforward\napproach which harnesses great technical SEO power over your site\u2019s structure, page\nelements and content.&nbsp;&nbsp; <\/p>\n\n\n\n<p>There are no limits to what\nyou can do, or more to the point, I\u2019ve been able to implement a wide range of\ntags and elements in order to enhance pages, functionality and tracking across\nnumerous sites.<\/p>\n\n\n\n<p>I will share more examples of\nthese moving forward.&nbsp; <\/p>\n\n\n\n<p>Just be careful, it\u2019s just as\neasy to do great damage if you don\u2019t properly configure and throughloy test\nyour triggers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Technical SEO changes can often be difficult to implement without developer support.  Use Google Tag Manager to add code such as robots meta tags to a website with ease.<\/p>\n","protected":false},"author":1,"featured_media":67,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,13,8],"tags":[],"class_list":["post-66","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-crawl-rate","category-on-page-seo","category-tag-manager"],"_links":{"self":[{"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/posts\/66","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/comments?post=66"}],"version-history":[{"count":0,"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/posts\/66\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/media\/67"}],"wp:attachment":[{"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/media?parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/categories?post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/tags?post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}