How to Use Google Analytics with WordPress
If you have a blog or website, you need Google Analytics — end of story.
Although it’s a free tool, it’s an incredibly valuable way to demystify your site data, and it has long been the standard in helping webmasters figure out whether they’re meeting their traffic goals. (Or what their traffic goals should be in the first place!)
Generally speaking, Google Analytics (GA) is a program you install on your site to track and analyze data. It is the most widely used analytics software on the internet. GA tracks the following key data:
- Pageviews: What’s the most popular article on your site this year, this month, or today? Glance at your pageviews and you’ll know.
- Unique visitors: One person may view a page multiple times, so GA also tracks the number of unique visitors to your site using said visitor’s device or IP address.
- Bounce rate: When people visit your site, do they stay a while or leave right away? GA tracks your bounce rate, aka the rate of people who exit after viewing one page.
- Session duration: How long do people stay on your site, and how many pages do they view on an average visit? A longer duration means visitors are invested in your content.
- Traffic source: When you get an influx of pageviews, where are they coming from? Whether it’s a popular tweet or viral Facebook post, GA will know the source.
By keeping you informed about this vital website data, Google Analytics can help open up opportunities for your website or blog. When you offer to review another company’s product or host a banner ad, you can helpfully show them your average monthly number of visitors so they will know how many people are likely to see it.
Here are four easy steps to install Google Analytics, so you can be reaping its benefits within 20 minutes.
Brush up on the differences between WordPress.com and WordPress.org before you get started.
1. Create a Google Analytics Account
First, you need to set up an account with Google Analytics. If you already have a primary Google account that you use to access Gmail, Google Drive, Google Calendar, Google+, or YouTube, you simply need to log into that and skip to the third paragraph.
If you don’t have a Google account yet, you need to set one up. Just visit myaccount.google.com and let it walk you through the steps.
Sign into your Google account and navigate to Google Analytics. You’ll see a big gray “sign up” button. Click that.
Now, GA will ask you to provide some information about the property you want to track. Is it a website or a mobile app? What’s name of the site and its URL? What’s your timezone? Fill this out and click the “get tracking ID” button at the bottom of the page.
2. Get the Tracking Code
Now Google Analytics has information about your website, but your website doesn’t have the information it needs to connect with Google Analytics. So we’re going to find a snippet of code to put on your website to enable data tracking.
Once you are logged into a GA account, you’ll be taken to the Dashboard page. In the lower left-hand corner of the Dashboard, you’ll see a button that says Admin, which has a gear graphic next to it. Click that.
Now select your GA account and the property you want to track. In this screenshot, the account is my main domain, laurenraeorsini, and the property I want to track is called Candle Fandom. Under Tracking Info, click the link that says “Tracking Code.”
This shows us the Tracking ID and the tracking code itself. Don’t worry, you don’t need to understand what this code says in order to work with it. Copy and paste this code somewhere you’ll have it handy because now we’re going to paste it onto your WordPress site.
How much does it actually cost to run a WordPress website? You might be surprised.
3. Install the Tracking Code
It’s time to put this bit of code on your site so that it can connect with GA. Google’s instructions state to put the tracking code “just before the closing </head> tag.” If you know HTML, then you know this means it goes into the head of the website document, where all the preloaded scripts belong before the body content of the website appears for visitors.
However, with WordPress, it can be kind of tricky to find that closing </head> tag in your theme files. That’s why I recommend using the Insert Headers and Footers plugin for WordPress, which will give you a text box to insert a header or footer script inside.
Once it’s installed on your site, navigate from the WordPress dashboard to Settings → Insert Headers and Footers. Paste the GA script in the header text box, as is.
4. Test and Track
Finally, it’s time to make sure the code worked. While it will take about 24 hours for Google Analytics to begin monitoring data, you can test this right away.
Return to the page where you got the tracking ID and click “Send test traffic.” GA will open up your website in a new window, and tell you how many active users are on the site. There should be at least one active user, counting your test traffic.
If that works, sit tight for a day. Starting then, you can begin to monitor your traffic. Once again, here’s my Candle site as a demo.
Right up front, you can see the most vital stats — pageviews, unique visitors, bounce rate, and session duration. You can also see a pie chart indicating how much traffic is coming from new users who haven’t visited before, and how many are returning.
Another part of Google Analytics that is helpful to monitor is Acquisitions, also known as the sources where your visitors are coming from. Scroll down on the lefthand side to Acquisitions and click “Overview.” Here, I can see that 94% of my visitors are coming from organic search. In other words, they arrived after conducting a Google or Bing search.
Does your WordPress website need an SEO SOS? Here are 13 ways to boost your ranking.
Another helpful feature to monitor is Behavior. Scroll down below Acquisition to find the Behavior section, and click “Overview.” Here, I can check which of the pages on my website are most popular with readers. See the page that’s just a forward slash? That’s Google Analytics parlance for the homepage.
These are just a few data points I can monitor with Google Analytics, but it’s already enough to drastically influence the way I market my site to potential advertisers and companies that might want me to review samples of their product. It’s a free, easy solution, but it will help you get to know your site’s strengths and weaknesses like you never have before.