{"id":75395,"date":"2016-08-31T10:02:16","date_gmt":"2016-08-31T14:02:16","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=75395"},"modified":"2017-08-24T05:18:06","modified_gmt":"2017-08-24T09:18:06","slug":"magento-2-x-integrate-google-analytics","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/magento-2-x-integrate-google-analytics.html","title":{"rendered":"Magento 2.x. How to Integrate Google Analytics"},"content":{"rendered":"<p>This guide will show you how to integrate the Google Analytics code to your <a href=\"https:\/\/www.templatemonster.com\/magento-themes.php\" target=\"_blank\">Magento 2<\/a> store.<\/p>\r\n\r\n <div class=\"video-container\">\r\n\t<iframe src=\"https:\/\/www.youtube.com\/embed\/v4MOfyI2bUE\"><\/iframe>\r\n<\/div>\r\n<p>In order to add the Google Analytics code, you should perform the following:<\/p>\r\n<ol>\r\n\t<li>\r\n        <p>The first step is locating your <strong>account ID in Google<\/strong>. You will first need to obtain your tracking code from the Google Analytics account by following this <a target='_blank' href='https:\/\/support.google.com\/analytics\/answer\/1008080?hl=en'>detailed tutorial<\/a>.\r\n\t\t<\/p>\r\n\t<\/li>  \r\n    <li>\r\n\t\t<p>You should get the code <strong>similar to the one, presented below<\/strong>:<\/p>\r\n\t\t<pre class=\"brush:js\">&lt;script type=&quot;text\/javascript&quot;&gt;   \r\n\tvar _gaq = _gaq || [];    \r\n\t_gaq.push(['_setAccount', 'UA-12345-6']);    \r\n\t_gaq.push(['_trackPageview']);      \r\n\r\n\t(function() {      \r\n\tvar ga = document.createElement('script');  ga.type = 'text\/javascript'; ga.async = true;      \r\n\tga.src = ('https:' == document.location.protocol ? 'https:\/\/ssl' : 'http:\/\/www') + '.google-analytics.com\/ga.js';      \r\n\tvar s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);   \r\n\t})(); \r\n&lt;\/script&gt;<\/pre>\r\n\t<\/li>\r\n    <li>\r\n        <p>&#8216;<strong>UA-XXXXX-X<\/strong>&#8216; in your code ( where 12345-6 stands for your Account ID number) is your <strong>Google Account ID<\/strong>.\r\n\t\t<\/p>\r\n\t<\/li>\r\n    <li>\r\n\t\t<p>Log into your <strong>Magento Admin Area<\/strong> and navigate to <strong>Stores -> Configuration<\/strong> section.<\/p>\r\n\t<\/li>\r\n    <li><p> Access the <strong>Sales -> Google API<\/strong> section and expand the <strong>Google Analytics<\/strong> option.\r\n\t<\/p>\r\n\t\r\n<a class=\"darkbox\" href=\"\/help\/wp-content\/uploads\/2016\/08\/Magento_2.x._How_to_Integrate_Google_Analytics_code1.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2016\/08\/Magento_2.x._How_to_Integrate_Google_Analytics_code1-300x154.jpg\" alt=\"Magento_2.x._How_to_Integrate_Google_Analytics_code1\" width=\"300\" height=\"154\" class=\"alignnone size-medium wp-image-75410\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/08\/Magento_2.x._How_to_Integrate_Google_Analytics_code1-300x154.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/08\/Magento_2.x._How_to_Integrate_Google_Analytics_code1-150x77.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/08\/Magento_2.x._How_to_Integrate_Google_Analytics_code1-768x395.jpg 768w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/08\/Magento_2.x._How_to_Integrate_Google_Analytics_code1-1024x526.jpg 1024w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/08\/Magento_2.x._How_to_Integrate_Google_Analytics_code1.jpg 1265w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\t\r\n\t<\/li>\r\n    <li><p>Enable it and paste the tracking code to the <strong>Account Number<\/strong> field. Next, click on the <strong>Save Config<\/strong> button to apply the changes. \r\n\t<\/p>\r\n\t\r\n<a class=\"darkbox\" href=\"\/help\/wp-content\/uploads\/2016\/08\/Magento_2.x._How_to_Integrate_Google_Analytics_code2.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2016\/08\/Magento_2.x._How_to_Integrate_Google_Analytics_code2-300x76.jpg\" alt=\"Magento_2.x._How_to_Integrate_Google_Analytics_code2\" width=\"300\" height=\"76\" class=\"alignnone size-medium wp-image-75411\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/08\/Magento_2.x._How_to_Integrate_Google_Analytics_code2-300x76.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/08\/Magento_2.x._How_to_Integrate_Google_Analytics_code2-150x38.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/08\/Magento_2.x._How_to_Integrate_Google_Analytics_code2-768x194.jpg 768w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/08\/Magento_2.x._How_to_Integrate_Google_Analytics_code2.jpg 906w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\t\r\n\t\r\n    <\/li>\r\n<\/ol>\r\n<div class=\"inline-banner\">\r\n<a href=\"https:\/\/www.templatemonster.com\/service-center\/\">\r\n<img src=\"\/help\/files\/banners\/inline\/Banner-2-(835-x100).jpg\"\/>\r\n<\/a>\r\n<\/div>\r\n<p>This is the end of the tutorial. Feel free to check the detailed video tutorial below:<\/p>\r\n<a href=\"http:\/\/www.youtube.com\/watch?v=v4MOfyI2bUE?width=1280&amp;height=720\" rel=\"prettyPhoto\">Magento 2.x. How to Integrate Google Analytics<\/a>","protected":false},"excerpt":{"rendered":"<p>This guide will show you how to integrate the Google Analytics code to your Magento 2 store.<\/p>\n","protected":false},"author":61,"featured_media":75412,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[729],"tags":[2187,2315,1044],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/75395"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/61"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=75395"}],"version-history":[{"count":2,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/75395\/revisions"}],"predecessor-version":[{"id":82897,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/75395\/revisions\/82897"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/75412"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=75395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=75395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=75395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}