Once your WordPress website is up and running, some of the questions you’ll start asking include:
- Is anyone visiting my site?
- How long are they staying?
- How did they find me?
- What were they looking for?
- What did they read when they got here?
It turns out that Google is also interested in the answers to these questions so that they can decide when your site might be worthy of inclusion in search results. So they (Google) keep track of lots of information about your site and your visitors. Fortunately, they make this information available to you (the website owner and webmaster) through 2 free services: Google Analytics and Google Webmaster Tools. You’ll need a free Google account to use these services.
To get started with Google Analytics, login to your Google account and go to http://google.com/analytics. Click the Sign Up button to get started; you’ll be prompted to set up a new Analytics account by providing a name for the account (you can have multiple Analytics accounts in 1 Google account) and a name and the url for your website. You can also choose an Industry Category (for comparisons) and the reporting Time Zone for your account. Finally, you can “opt-out” of various options for sharing your Analytics data with other Google services and staff – leave the option checked to share data “With other Google products only” to enable additional features for analysis. Click “Get Tracking ID” and accept the Terms of Service (read them if you dare!) and you’ll be taken to your new Google Analytics Admin page.
Now, you need to update your website to connect it to your Analytics account. There are 2 basic approaches to this task:
- Copy the tracking code from your Admin page and paste it in the WordPress header.php file (not as scary as it sounds)
- Use a WordPress plugin to add your tracking code and view your Analytics data from within your WordPress “back-end”
The second approach is pretty convenient (and easy) – all you need to do is pick a plugin (from wordpress.org – the “repository”) and install and configure it. Google Analytics by Yoast is a pretty good choice. However, you may want to limit the number of plugins on your site (plugin conflicts can cause unexpected errors that are hard to diagnose), so here’s how to do the first option:
- Highlight the tracking code on your Google Analytics Admin page – it starts with <script> and ends with </script>. Press ctrl-C (Windows) or command-C(Mac) to copy the code to your clipboard.
- Login to your WordPress site. Hover over the Appearance menu item and select Editor from the flyout menu.
- DO NOT BE AFRAID! The Editor screen is a bit scary; it’s also VERY powerful, so take care. Select Header (header.php) from the list of “templates” on the right side of the screen.
- This will open up the header.php file in the editor. Locate the line that reads </head> (it should be on its own line:
- Place your cursor just in front of the “<” (at the very start of the line) and press ctrl-V (Windows) or command-V (Mac). If all goes well, you should now see your tracking code (from Step 1) in your header.php file. Make sure “</head>” is on its own line (you may have to move your cursor and click Enter to create a new line for it).
- Click the Update File button to save your changes, and you’re done (for now)!
Back at your Google Analytics Admin page, click on the Tracking Code link for your page (referred to as a “Property”). This was the page you were on when you copied the Tracking Code in step 1 – you may need to refresh the page if you’re still there. You should now see the Status of your Tracking ID – it will start at “Tracking Not Installed”, but this will change shortly if you installed the Tracking Code correctly.
Thanks to Mickey Mellen for his concise guidance on using Google Analytics and Google Webmaster Tools to manage your WordPress site. http://www.greenmellenmedia.com/google-analytics-101/