Google Analytics Setup
In order to know whether you are improving the performance of your website, you need a way to measure your progress. This is where Google Analytics comes in.
Step 1: Create a Google Account
You will need a Google account. It’s easiest to create a gmail account, although it is still possible to create a non gmail account as a Google account.
Step 2: Create an Account for your Website in Google Analytics
Once you have created your Google account, navigate to Google Analytics and click on “Admin”. Enter the name of the account, website and website URL (see below). NOTE: As of April 2014, all new GA accounts use Universal Analytics.
Click on the “Get Tracking Id” button. Note: Depending on which approach you take, you may need both the UA code and the tracking code shown on the next screen.
Step 3: Install the Google Analytics tag onto your website
The way that Google Analytics works is that when a visitor comes to one of your web pages, a piece of code that has been installed into your website fires and sends the tracking information to your Google Analytics account. So you need to install the GA tracking code into your website in this step. Fortunately there are plugins that make this easy for you.
We’ll use a popular one called “Google Analyticator”. Google Analyticator makes the installation fairly easy and even adds a dashboard into your WordPress admin. This plugin is available in the WordPress repository, so to install just click on “Add New” and type in “Google Analyticator” to find it. Once installed, navigate to the plugin page and click on “Settings” for the plugin.
There are two ways you can use Google Analyticator:
- Authenticate the plugin with Google: You give the plugin permission to access your Google account. If you want the dashboard you must authenticate.
- Just use the plugin for tracking: Skip the authentication and go directly to the Settings screen. You will need the UA Tracking id if you skip the authentication.
Most of the settings I leave as is – except the ones I note in the screenshot below:
Advanced
If you have many plugins and are concerned about performance, you may want to skip using a plugin and install the code directly into your theme. This is an advanced approach that requires you be able to edit your functions.php file on your server.
In the functions.php file you want to add both an action and the function “add_googleanalytics” as in the below:
function add_googleanalytics() { ?<
Insert the code you copied from GA here.
It should begin and end with <script> tags
<?php }
add_action('wp_head', 'add_googleanalytics');
Google Webmasters Tools Setup
Google Analytics helps you track your website’s traffic. Google Webmasters Tools is the channel Google uses to communicate to you any problem its crawlers might find on your site. You should set both up.
Fortunately once you have Analytics setup, it’s easy to also setup Google Webmasters Tools as it will just verify based on the Analytics code you just installed in your website.
- While logged into your Google Account (the same one you are using for Google Analytics), go to Google Webmaster Tools
- Click on the red “Add a Site” button (located at the upper right)
- In the popup, type in the URL of your website and click on Continue.
- Then click on the Verify prompt to complete the setup