Zip has installed WordPress, completed much design work, and has recently installed an SEO plugin and learned how to configure a post to optimize it for search engines. Currently, he has a functioning website — few posts, but users could visit and read what he has so far, though he has much left to do. Likely, he’ll want to know how many visitors come to his website, what people are reading, how much time they spend there. He’ll want to add analytics to his website. We’ll be adding Google Analytics to WordPress using a plugin.
Do I Need Google Analytics?
That depends. I’ve read some posts saying you need analytics. Most website owners want to know a bit about whether people are visiting their website, though I had a client who had no interest in this, just how many leads he received and did not want any analytics on his website. I admired that, actually, and if you’re not running analytics, personalized ads, and such, you don’t have as much to worry about when it comes to privacy issues. If you don’t want analytics, you don’t need to install any.
However, you probably do want to know about website statistics. If you want basic stats, alternatives to Google Analytics exist. Jetpack includes site stats in their popular plugin1 and will satisfy your needs if you want simple site stats. However, I don’t consider Jetpack stats a true alternative to Google Analytics if you want the rich data Google analytics provides.
Google Analytics offers the most robust set of stats, is highly customizable, and connects with their other properties. You’ll want it, for instance, if you plan to run Google Adsense ads on your website, use Google Optimize to run AB tests on your website, or advertise with Google Ads. If your website traffic is high enough and you want to apply for advertiser programs like Ezoic or Mediavine, they’ll want to know your stats in Analytics. Some affiliate programs will as well. I could go on.
Adding Google Analytics to WordPress
Several ways exist to add Google Analytics to WordPress. You can add it to the code you’ll get when you sign up to the header of your website, you can add it via Google Tag Manager, or you can use a plugin. Here, we’ll be looking at creating an account and adding it using a plugin, as this is a beginning tutorial. Setting it up in the plugin is simple and varies with which one you choose, so I won’t be going over specifics of the plugin itself.
My favorite way to add analytics, now, is through Google Tag Manager. However, setting up tag manager is much more complicated so we’ll be going over that beyond this beginning series.
Adding Google Analytics to Your WordPress Website With a Plugin
- Create an account
If you don’t have a google account, you’ll need to create one — that is, have a gmail address. If you do, go to https://analytics.google.com and log in.
- Click Admin
It’s in the lower left hand part of the screen with the gear icon. This will take you to the area where you can add a new account.
- Add a new Account
Click the “Create Account” button.
- Add your account name and sharing settings.
Add your account name, select data sharing settings, and click “next.”
- What do you want to measure?
For this, we’re selecting “Web,” as we’ll be measuring a website. Then click “next.”
- Property Setup
Add your website name, URL, choose an industry category from the drop-down and choose your time zone. Then press “Create.”
- Accept the Terms of Service
Read and accept the terms of service and press, “I accept.”
- Get Your Tracking ID
After you accept the TOS, your tracking ID will appear where the red circle is here. It will be a number and letter pattern in the form of UA-xxxxxxxxx-x. Save this. You’ll need this code to add Analytics to your website. You’ll notice below that is the gtag.js code. Adding that to the header of every page on your website is one way to install analytics. The other ways are through a plugin or through Google Tag Manager.
- Install And Configure a Google Analytics Plugin
Here, we have several choices available in the WordPress plugin repository. Three popular choices for free plugins that I have used are Monster Insights, Analytify, and GA Google Analytics. They’re all good plugins, all allow you to insert the tracking code you got above — Monster Insights and Analytify go a step further and allow you to easily connect with Analytics via your Google account. Both of those plugins also offer a dashboard so you can peruse your stats right from your WordPress admin. And, of course, all have pro versions. The pro version of Analytify is less expensive than Monster Insights and lets you add some features in a more a-la-carte way. However, tracking clicks on affiliate links, if that’s important to you, is easier to set up in MonsterInsights (included in the free version) and the pro version includes tracking custom dimensions. But at this point, Zip isn’t interested in that, he just wants to set up analytics — and if he wants to set up custom dimensions we’ll go over how to use Tag Manager then.
But any of these plugins is pretty simple to set up once you’ve created your Google Analytics account and all will work well to add Google Analytics to your website. Zip is going with Monster Insights for now. If you’re not sure how to install a WordPress plugin, read this.
- Check to Make Sure the Tracking Code is Working
After you’ve installed and configured the analytics plugin you chose, return to Google Analytics, again click the Admin icon in the lower left (gear), and the “tracking code: link, which you’ll find in the Property Settings (central) column.
At the top of the page, you’ll find a button that says “Send Test Traffic.” Click it and it will send a test visit to your website. If you plugin is blocking admin views, you might not see any active users here even if analytics is installed correctly. Try opening your website in a separate browser in which you’re not logged in, wait a bit, and see if that generates any test traffic.
If it’s working, you should see something like the message below.
- Congratulations! You now have Google Analytics installed on your website.
If you installed a plugin with dashboard stats, you’ll start seeing stats there. But for even more information, look in Google Analytics itself. Analytics has so much you could set up that an entire website could be centered around it.
But for now, we’ll just look at a few more settings Zip may want to change right away.
- Edit View Settings
If you click on Admin (that gear again) and then go to the column on the right and click View Settings, you’ll see something like the image below.
Know that you can create different view settings, if you’d like. Right now Zip has only one and it’s called “All Web Site Data.” We’ll just work with that for now. But you can create additional views. This can be helpful if you want to have a basic view will add data and then a view with specific filters. You could, for instance, have a view that filters out traffic from certain IP addresses.
Make sure that the URL and time zone are correct for your view. I like to check the box to filter out views from known bots and spiders (who wants those visits counted?)
Below that, you’ll see site search settings. Configure this if you’d like to know what people are searching for in an internal search on your website. Switch it on and add the query parameter. On every WordPress website I own, this is s. If you want to confirm this, search for something on your website, and see what appears in the URL after the ?. If Zip searches for “coloring” on his website, the query looks like this: https://www.slothverse.com/?s=coloring so the parameter he’ll want here will be s.
Below that, you can enable site search categories. This is if you have search on your website that includes additional parameters. If, for instance, you’re configuring your view to track product searches vs site searches and the products have subcategories expressed with additional parameters, you can add those here.
- Add Filters
If you would like to filter out internal traffic, one way to do it is by adding a filter in Analytics. You can add and edit filters in the admin area of Analytics by either accessing All Filters from the first column or Filters from the third column on a per-view basis.
Give your filter a name, choose “exclude,” “traffic from the IP addresses,” and “that are equal to.” Then enter your IP address. I like to make separate filters for my IPv4 and IPv6. If you’re in the “All Filters” area, make sure you add the views to which you wish to apply this filter. Save.
Not sure what your IP address is? You can look on a website like https://whatismyipaddress.com/.
Know that this has not worked for me 100% of the time. I also use a browser addon to stop analytics from tracking me when I visit my own websites.
Should he enable Google Search Console. A resounding YES if he’s using Google Analytics. Google Search Console lets you know how your website is appearing in Google search results, how your website is ranking for various search terms, what people are clicking through on to your website, and will let you know if your website has any errors that affects its placement in Google’s search results.
We’ll be going over adding Google Search Console in the next post.
We're sorry you didn't like this post.
Help us improve!
Tell us how we can improve this post.
- Though I’ll eventually write an entire post about Jetpack and its advantages and disadvantages.