{"id":2118,"date":"2021-06-10T16:28:10","date_gmt":"2021-06-10T13:28:10","guid":{"rendered":"https:\/\/www.scalahosting.com\/kb\/?p=2118"},"modified":"2022-06-08T14:58:01","modified_gmt":"2022-06-08T11:58:01","slug":"add-google-analytics-to-my-site","status":"publish","type":"post","link":"https:\/\/www.scalahosting.com\/kb\/add-google-analytics-to-my-site\/","title":{"rendered":"Add Google Analytics to My Site"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Google Analytics is a very reliable way to <\/span><b>get extensive website visitor information<\/b><span style=\"font-weight: 400;\">. To use this feature, you will need<\/span><b> a Google Analytics account<\/b><span style=\"font-weight: 400;\"> and then add the necessary tracking scripts to your website.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Applying for a Google Analytics Account<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">First, visit the <\/span><a href=\"https:\/\/analytics.google.com\/analytics\/web\/provision\/#\/provision\"><span style=\"font-weight: 400;\">Google Analytics website<\/span><\/a><span style=\"font-weight: 400;\"> to apply for an account. You can use an existing Google account to get access to the Analytics dashboard. Next, you will need to add your website to your Google Analytics account.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Adding your site to the dashboard will require a <\/span><a href=\"https:\/\/support.google.com\/webmasters\/answer\/9008080?hl=en\"><span style=\"font-weight: 400;\">verification process<\/span><\/a><span style=\"font-weight: 400;\">. This verification helps Google ensure that you own the website.\u00a0<\/span><\/p>\n<p><b>Obtaining Your Google Analytics Tracking Code<\/b><\/p>\n<div id=\"attachment_2119\" style=\"width: 978px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" aria-describedby=\"caption-attachment-2119\" class=\"wp-image-2119 size-full\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/Google-GST-Code.jpg\" alt=\"Add Google Analytics to My Site, Applying for a Google Analytics Account\" width=\"968\" height=\"208\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/Google-GST-Code.jpg 968w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/Google-GST-Code-300x64.jpg 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/Google-GST-Code-768x165.jpg 768w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><p id=\"caption-attachment-2119\" class=\"wp-caption-text\">The Google tracking code is a short script snippet you must embed in your site code.<\/p><\/div>\n<p><b>Once you\u2019ve verified your website, you can then retrieve the tracking code:<\/b><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">On your Google Analytics account, click the \u201cAdmin\u201d link at the bottom left of the display.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Select an account from the dropdown menu under the \u201cAccount\u201d column<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Select a property from the dropdown menu under the \u201cProperty\u201d column.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Click \u201cTracking Info &gt; Tracking Cookie\u201d under \u201cProperty.\u201d<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">The final step above will open a screen showing you the tracking code, called \u201cGlobal Site Tag.\u201d<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Using the Google Analytics Tracking Code<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Once you have your Google Analytics account set up and have added your website, you need to add the tracking code to the website to begin sending visitor data to Google. This step requires the use of<\/span><b> a tracking ID, <\/b><span style=\"font-weight: 400;\">which is in your Google Analytics account.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">There are several ways you can make use of the tracking code. For most conventional websites, this is typically done via <\/span><b>the Google Tag Manager or by directly embedding the script within your website code.<\/b><\/p>\n<h3><span style=\"font-weight: 400;\">Option 1. Google Tag Manager<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Google Tag Manager offers an easy way to manage tracking code for multiple websites. Log in to your <\/span><a href=\"https:\/\/tagmanager.google.com\/\"><span style=\"font-weight: 400;\">Google Tag Manager dashboard<\/span><\/a><span style=\"font-weight: 400;\">. Next;<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Click \u201cCreate Account\u201d and furnish Google Tag Manager with the information requested.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">From the dashboard, click on the Container Name you just created.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Click \u201cAdd New Tag,\u201d then click the \u201cTag Configuration\u201d work area.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Select \u201cGoogle Analytics: Universal Analytics\u201d on the menu that appears.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Select the track type you prefer (such as Pageview).<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Select the \u201cTriggering\u201d workspace and choose the events which will enable the tracking tag to work. In this case, the option should be \u201cAll Pages.\u201d<\/span><\/li>\n<\/ol>\n<h3><span style=\"font-weight: 400;\">Option 2. Embedding Script<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">How you embed the script will vary depending on the type of website operated.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">For HTML Sites:<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">You can also choose to embed the Google Analytics script directly within your website <\/span><b>HTML code. <\/b><span style=\"font-weight: 400;\">To do this:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Copy the Google Site Tag script from your Google Analytics account<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">You then need to paste the script in the code ( before the &lt;\/head&gt; tag) of every page on your website for which you wish to track visitor information.\u00a0<\/span><\/li>\n<\/ol>\n<h4><span style=\"font-weight: 400;\">For Dynamic Sites<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">Dynamic websites are those generated on user request by<\/span><b> using scripts such as PHP<\/b><span style=\"font-weight: 400;\">. Adding the script on this type of site is more streamlined since you do not need to embed the entire script on every page &#8211; you can use an include<\/span><b> function.<\/b><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Copy the script from your Google Analytics account.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Create a file (e.g., MyGA-Tracking.php) and paste the script.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Add the script to each template page after the &lt;body&gt; tag; <\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span> <span style=\"font-weight: 400;\">&lt;?php include_once(&#8220;analyticstracking.php&#8221;) ?&gt;<\/span><\/li>\n<\/ol>\n<h4><span style=\"font-weight: 400;\">For Web Applications<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">Web applications such as<\/span> <a href=\"https:\/\/www.scalahosting.com\/fastest-wordpress-hosting.html\"><b>WordPress<\/b><\/a><b> and Joomla<\/b><span style=\"font-weight: 400;\"> often offer modular features that support Google Analytics. You will generally seek a plugin or extension built for this purpose and install it in cases like this.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Once installed, you only need to provide the extension with your <\/span><b>Google Analytics tracking ID, and it will handle the rest for you.<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Google Analytics is a very reliable way to get extensive website visitor information. To use this feature, you will need a Google Analytics account and then add the necessary tracking scripts to your website. Applying for a Google Analytics Account First, visit the Google Analytics website to apply for an account. You can use an [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","_seopress_analysis_target_kw":"","footnotes":""},"categories":[34],"tags":[],"class_list":["post-2118","post","type-post","status-publish","format-standard","hentry","category-web-hosting"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/comments?post=2118"}],"version-history":[{"count":2,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2118\/revisions"}],"predecessor-version":[{"id":4838,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2118\/revisions\/4838"}],"wp:attachment":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/media?parent=2118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/categories?post=2118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/tags?post=2118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}