How to add code on a WordPress site: Google Analytics
The following is the second in a three-part series about Google Analytics, addressing common how-to questions.
Google Analytics is a great tool, allowing you to see all types of statistics about your website. For you to be able to access this data, code from Google Analytics must be placed on your website, so Google knows when your site is visited and can gather data. There are two main ways to accomplish this: first, by placing the code directly into the header on the site, and second, by using a WordPress plugin.
Step 1: Find the Tracking Code
Login to Google Analytics, navigate to the “Admin” tab and click on “Tracking Code.”
Locate the tracking code and copy and paste.
Once you’ve located and copied the code, there are two ways to place it in WordPress.
Method 1: Header
In the back end of your site, go to “Appearances” > “Editor.” Find the header.php file, and paste the tracking code at the end of the head tag.
Method 2: WordPress Plugin
Instead of going into the code yourself, you can simply install a plugin and past the code there. Google Analytics by Yoast is a good plugin to use.
Once you’ve placed the code, Google Analytics will be set up for your website!