{"id":3484,"date":"2017-08-23T06:59:46","date_gmt":"2017-08-23T06:59:46","guid":{"rendered":"https:\/\/ampforwp.com\/tutorials\/?post_type=ht_kb&#038;p=3484"},"modified":"2020-07-17T08:55:49","modified_gmt":"2020-07-17T08:55:49","slug":"gtm-in-amp","status":"publish","type":"ht_kb","link":"https:\/\/ampforwp.com\/tutorials\/article\/gtm-in-amp\/","title":{"rendered":"How to Add Google Tag Manager ( GTM ) in AMP for WP"},"content":{"rendered":"<p>Google Tag Manager (GTM) is a valuable tool that helps website owners consolidate their multiple tracking services into one, and gives a user one simple dashboard for all their analytics scripts.<\/p>\n<ol>\n<li><a href=\"https:\/\/ampforwp.com\/tutorials\/article\/gtm-in-amp\/#1-implemention-of-gtm\">Implemention of GTM<\/a><\/li>\n<li><a href=\"https:\/\/ampforwp.com\/tutorials\/article\/gtm-in-amp\/#2-troubleshooting-in-gtm\">Troubleshooting in GTM<\/a><\/li>\n<\/ol>\n<h3><mark style=\"background-color: #f5f5f5;\">1. Implemention of GTM<\/mark><\/h3>\n<p><strong>First, you need to create a Tag manager (Container ID) :<\/strong><\/p>\n<p>Create the Google Tag Manager container at:<br \/>\n<a href=\"https:\/\/tagmanager.google.com\/\" data-skip-pjax=\"\">https:\/\/tagmanager.google.com<\/a><\/p>\n<p>Then you should create separate containers for the standard WordPress site and the&nbsp; AMP version.<\/p>\n<p><a href=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/gtm_amp_container-1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-17491\" src=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/gtm_amp_container-1.png\" alt=\"\" width=\"1524\" height=\"606\" srcset=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/gtm_amp_container-1.png 1524w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/gtm_amp_container-1-300x119.png 300w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/gtm_amp_container-1-1024x407.png 1024w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/gtm_amp_container-1-768x305.png 768w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/gtm_amp_container-1-50x20.png 50w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/gtm_amp_container-1-60x24.png 60w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/gtm_amp_container-1-100x40.png 100w\" sizes=\"(max-width: 1524px) 100vw, 1524px\" \/><\/a><\/p>\n<p>creating&nbsp;the AMP container then you must choose container type= &#8220;AMP&#8221;<br \/>\nWhen creating the container for use with the NON-AMP then you should create a container type= &#8220;Web&#8221;<\/p>\n<p>This means there will be different &#8220;container&#8221; \/ &#8220;container type&#8221; and different tags for the AMP and the non-AMP version of the site.<\/p>\n<p><strong>Follow the steps below to Add Google Tag Manager ( GTM ) in AMP for WP:<\/strong><\/p>\n<ul>\n<li>From your WordPress dashboard, go to your sidebar. Head on over to&nbsp;<strong>AMP<\/strong>&nbsp;<strong>option panel -&gt;<\/strong> Click on <strong>Settings<\/strong> -&gt; <strong>Analytics<\/strong> -&gt; <strong>Google Tag Manager<\/strong><\/li>\n<\/ul>\n<p><a href=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/10.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-17524\" src=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/10.png\" alt=\"\" width=\"1223\" height=\"554\" srcset=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/10.png 1223w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/10-300x136.png 300w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/10-1024x464.png 1024w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/10-768x348.png 768w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/10-50x23.png 50w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/10-60x27.png 60w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/10-100x45.png 100w\" sizes=\"(max-width: 1223px) 100vw, 1223px\" \/><\/a><\/p>\n<ul>\n<li><strong>Google Tag Manager<\/strong>: If you enable Google Tag Manager we can track particular tags on websites.<\/li>\n<li><strong>&nbsp;Tag Manager ID (Container ID):<\/strong> In this field, you can enter the Tag Manager ID (Container ID).<\/li>\n<li><strong> Advanced Google Analytics: <\/strong>If you enable this option you can&nbsp; Enter your Advanced Analytics code here inside this code you have to write account number for ex :(\u201caccount\u201d: \u201cUA-xxxxxxx-x\u201d).<\/li>\n<li><strong>&nbsp;IP Anonymization:<\/strong> By default, this option enables it will show the IP address<\/li>\n<\/ul>\n<p>We are always updating this tutorial. If you have an insight or something that can help other users, then please write to us below.<\/p>\n<h3><mark style=\"background-color: #f5f5f5;\">2. Troubleshooting in GTM<\/mark><\/h3>\n<h4><strong>1. How to fix the console error &#8211; it has been blocked by CORS policy?<\/strong><\/h4>\n<p>If gtm amp container is correctly setup then also if you are getting cors policy error like the below screenshot then make sure the amp container is published and once you published it then this error will be fixed.<\/p>\n<p><a href=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/Part-Time-Money\u00ae-\u2013-Make-Extra-Money-in-Your-Free-Time-Google-Chrome-2019-05-08-10.46.07.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-9618\" src=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/Part-Time-Money\u00ae-\u2013-Make-Extra-Money-in-Your-Free-Time-Google-Chrome-2019-05-08-10.46.07.png\" alt=\"\" width=\"1360\" height=\"194\" srcset=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/Part-Time-Money\u00ae-\u2013-Make-Extra-Money-in-Your-Free-Time-Google-Chrome-2019-05-08-10.46.07.png 1360w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/Part-Time-Money\u00ae-\u2013-Make-Extra-Money-in-Your-Free-Time-Google-Chrome-2019-05-08-10.46.07-300x43.png 300w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/Part-Time-Money\u00ae-\u2013-Make-Extra-Money-in-Your-Free-Time-Google-Chrome-2019-05-08-10.46.07-768x110.png 768w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/Part-Time-Money\u00ae-\u2013-Make-Extra-Money-in-Your-Free-Time-Google-Chrome-2019-05-08-10.46.07-1024x146.png 1024w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/Part-Time-Money\u00ae-\u2013-Make-Extra-Money-in-Your-Free-Time-Google-Chrome-2019-05-08-10.46.07-50x7.png 50w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/Part-Time-Money\u00ae-\u2013-Make-Extra-Money-in-Your-Free-Time-Google-Chrome-2019-05-08-10.46.07-60x9.png 60w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2017\/08\/Part-Time-Money\u00ae-\u2013-Make-Extra-Money-in-Your-Free-Time-Google-Chrome-2019-05-08-10.46.07-100x14.png 100w\" sizes=\"(max-width: 1360px) 100vw, 1360px\" \/><\/a><\/p>\n<p><strong>That\u2019s it for this tutorial!<\/strong><\/p>\n<p>We hope it helped you. If you have any feedback or questions, then please share them in the comments section below.<\/p>\n<div id=\"div-1\" class=\"hkb-feedback\">\n\t\t\t<strong class=\"ht-mobile-exit__title\">Ask your Questions Directly!<\/strong><br>\n\t\t\t<div class=\"hkb_widget_exit__content\" style=\"font-size: 14px;\">If you can't find the solutions in this article, then just ask us in the comments and we will answer it for you!<\/div>\n\t\t\t<a href=\"https:\/\/ampforwp.com\/support\/#contact\" id=\"button\" target=\"_blank\" rel=\"noopener noreferrer\"><button>Yes, I have a Question<\/button><\/a>\n\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>Google Tag Manager (GTM) is a valuable tool that helps website owners consolidate their multiple tracking services into one, and gives a user one simple dashboard for all their analytics scripts. Implemention of GTM Troubleshooting in GTM 1. Implemention of GTM First, you need to create a Tag manager (Container&#8230;<\/p>\n","protected":false},"author":1,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":[],"ht-kb-category":[34],"ht-kb-tag":[25,80],"_links":{"self":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/3484"}],"collection":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/comments?post=3484"}],"version-history":[{"count":82,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/3484\/revisions"}],"predecessor-version":[{"id":17566,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/3484\/revisions\/17566"}],"wp:attachment":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/media?parent=3484"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb-category?post=3484"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb-tag?post=3484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}