Google Analytics is a service by Google that provides detailed website statistics for websites, blogs, and web/mobile applications. If you have a site or blog, you must have heard of it before, or even have an account already. There are many plugins available that help in setting up Google Analytics on WordPress. However, in this post, we will take a look at how to add Google Analytics code on your WordPress blog/site.
Step 1: Before creating a Google Analytics account, you need to have a Google/Gmail account. If you don’t, please create one at gmail.com.
Step 2: Once you have a Gmail account, go to google.com/analytics and sign in with your Gmail account.
Step 3: Once you sign in with your Gmail account details on the Analytics page, you will need to sign up on Analytics. Click on the “Sign Up” button to continue.
Step 4: Fill up the sign up form and accept the terms and conditions of Google Analytics. Once you do, you will be directed to a page with your account name. The landing tab would be “Tracking Info” (as shown below).
Step 5: Scroll down to find the tracking code (as shown below). Copy the code. This code needs to be paste before the closing head tag. Don’t worry, this will be explained in the next steps.
Step 6: Login on your WordPress site/blog with your admin account. On the left navigation, Go to “Appearance” and select “Editor” under the “Appearance” menu.
Step 7: You will see a page with a lot of code (PHP/HTML or CSS). Just find the header template from the right list named “Templates” (shown below). Click on the “header.php” template.
Step 8: In the code section, click once and then find “</head>” using your browser. Once you find </head>, paste the code copied from Google Analytics in Step 4 before the </head> as shown below.
Click on “Update File” at the bottom of the code and you’re all set! Go back to your Google Analytics account and click on the “Standard Reporting” to view statistics reports for your WordPress site.