Install Google Analytics in WordPress
Google Analytics is by far the most popular site-analytics system in the world. This fact has many causes, but one unarguable one is that it helps that Google Analytics is free. With or without that as a cause, it’s common to need to install GA in WordPress. I always use a plugin (though I’m pretty agnostic about which). Here’s why:
- As a plugin, you can change themes without it affecting your Google Analytics setup. This means that you’ll either not have an accidental gap in your data, and/or you don’t need to install it with each changing theme.
- I like excluding admins, and other WordPress users, from Analytics. You can write this code yourself relatively easily, but most plugins include this functionality for free, no effort required.
For this video, I chose to use “Google Analytics for WordPress by MonsterInsights”. Aside from having a lot of cool features, the plugin also has a nice long name. Here’s the video on how to set it up:
How to Create a Google Analytics Account/Site
- Be logged into your Google account that you want the Google Analytics accounts connected to.
- If you’re new to Google Analytics, you’ll be presented with a nice simple “wizard” process when you go to https://analytics.google.com. Walk through that process.
- If you don’t see the wizard at that URL, you’ve probably been attached to a GA account before. If that’s you, you’ll go to the gear “Admin” label on the left-hand side of the GA interface. There you’ll want to create a new “Account” by selecting “Create a new account” from the bottom of the dropdown on the left, which is labelled “Account”. That’ll give you the same screen the “wizard” does. (This is the process I go through in the above video).
How to Install Google Analytics in WordPress
- Go to “Plugins > Add New” in your WordPress site.
- Search for “Google Analytics” on that page. If you want to follow my process exactly, you may find it easier to search for “monster analytics” or some other subset of words in the title of the plugin (name in full in next step).
- Install and activate the “Google Analytics for WordPress by MonsterInsights” plugin.
- Once the plugin is active, you’ll have to set it up. You can find the setting page under “Insights > Settings” in the left side menu of your site.
- On that page, click the “Authenticate with your Google Account” button at the top of your page.
- You’ll proceed through the pop-up modal dialog until it says “Your code is…”. Copy the code you find.
- Paste that code into the Monster Insights box asking for it.
- Select the analytics account you want to use. Probably you’ll use the one you created following the steps above.
- You’re set.
You can verify that installation was successful by loading your site in a “Incognito” or “Private Browsing” window. If you “View Source” on that page, you should be able to find some numbers like “UA-#########-#” which you selected in step 8. Then you’ll start collecting data on what your site visitors are doing on your site. :)