How to Setup Google Analytics on WordPress
WordPress website? The 10 minute guide for the do-it-yourself install
Setting up new Google Analytics on WordPress is very simple process which even the most non-tech savy can do. In this guide we take you through the process step-by-step with one of the most popular (and free!) web analytics platforms available.
Before you Start...You will need
This guide assumes you already have the following setup:
- A gmail account and email adress
- Your website up and running
- Administrator access to the WordPress installation
If you're not convinced you need web analytics on your site please review our article here 'Benefits of Web Analytics'
Step 1. Create a Google Analytics Property
Go to the Google at analytics.google.com and when prompted enter your gmail username and password. Ensure this is account which you want to be the administration account for your new Google Analytics property.
Once logged in you should see the Google Analytics welcome screen:
Click the 'Set up for free' button and you should be presented with the following:
In the Account name field enter your Company name or brand. If you're a non-profit or community website just enter it's name. Don't worry too much this is just an friendly name to make it easy to identify the site so make sure it makes sense to you and anyone else who might look at Google Analytics in the future. We suggest leaving the defaults for notificaitons ticked for beginners. Click Next.
On the property type screen choose 'Web' at the what you want to track selection, like this:
The next screen is where you setup the property configurations. So in here you will see options for site name, url, sector selection and language and timezone. Configure the appropriate settings and click 'Create'
After agreeing to the various terms and conditions and data storage agreements you will be presented with the following screen:
This tracking code is the under the section 'Global Site Tag' is the tiny snippet of code you need to install into your wordpress site. Don't worry as you don't need to make any modifications just select all the code (including the <script> tags and paste it into notepad. We'll come back for it in a minute.
Step 2. Prepare your WordPress website
Next we need to setup WordPress ready to recieve the Google Analytics tracking code.
Jump over to your WordPress site and login, typically the url will be your home url with the path /dashboard appended to the end.
From your dashboard expand the 'Plugins' section and select 'Add New'. In the search box top right hand side enter 'Insert Headers and Footers'. The top entry in the returned list be the popular plugin by the popular developer WPBeginner. Click install and then 'Activate'
Plugins > Add New >
You should receive a success message after installation and no errors when you Activiate your new plugin.
Step 3. Inserting the Google Analytics Tracking code
Now navigate to the newly installed plug-in's settings by selecting 'Settings' and then 'Insert Headers and Footers'. You'll be presented with three panels into which you can enter scripts. Our Google Analytics tracking code needs to be inserted into the first section. Your screen should look like this:
Settings > Insert Headers & Footers >
Click into the 'Scripts in Header' box at the top and paste in the Google Analytics tracking code you placed into notepad in step 1. Remember to insert the closing </script> tag. Click Save and that's the end of the setup and installation steps.
Step 4. Checks and Testing
Now to make sure you've setup everything correctly!
Leave your WordPress dashboard where it is and on another web browser instance (if you've been working in Chrome open Firefox or Edge) Leave that browser session sitting on your homepage.
Finally, navigate back to Google Analytics browser page and on the left hand navigation panel you will see a collapseable section called 'Reports'. Click to expand that and then select 'Overview' from the sub menus.
You should see at least 1 active user being tracked in Google Analytics!
If you do, they your setup is working correctly.
You've created a new web property in Google Analytics, installed and setup a WordPress plug-in and inserted your Google Analytics tracking code into your website to fire on every visit to your site.
If you're new to Google Analytics try clicking around your site to check that each page view registers in the 'Content' section. Also try navigating your site on different browsers or a device type such as a tablet. You could also explore the Real-time view by arriving at your site by clicking through a Google organic search or maybe a social media post you've done previously. These different sources will show in the 'Traffic Sources' view.
Ready to learn more? explore the Google Analytics learning Academy