Learn how to add Google Analytics tracking code to a WordPress website with or without a plugin to help you track website visitors.
But first ….
Table of Contents
Top 10 reasons to use Google Analytics.
- Check total and organic traffic to my website
- Compare this month versus last month
- Check the number of leads and website conversions
- Look at the traffic to each page
- Look at the positions of keywords each page ranks for
- Analyse keywords at position 10 to 30 and discover ways to improve page rankings and traffic
- Check where my visitors come from and which device they use
- I now use Google Analytics to check individual page speed
- I now use Insights and Analytics Intelligence to look for website issues and opportunities
- I use Google Analytics on my WordPress dashboard too.
There are hundreds of reasons and ways to use Google Analytics; it just depends on your experience or the website you’re working on.
Let’s get started on adding Google Analytics to your WordPress website.
How to find your Google Analytics tracking code
Log into Google Analytics
Select your website from the All Account panel at the top of the page.
Select Admin from the bottom left menu.
In the property column, click Tracking Info, and then Tracking Code.
Click on the main box and select CMD + C to copy on a Mac or CTRL + C on a PC.
Keep this window open on your browser as you’ll need to access this page later.
Next step, add the tracking code to WordPress without a plugin.
Add tracking code to WordPress without a plugin
If you are a novice or beginner with WordPress I recommend that you backup your WordPress website or give this task to a developer or tech savvy marketer.
Login to WordPress and click Appearances then Editor
On the right side look for a file such as header.php or Theme Header (header.php)
Click your mouse just before the </head>
Click your mouse just before the </head> and paste the Google Analytics code you had previously copied.
You’ve added Google Analytics to your WordPress website without using a plugin.
If you already have Analytics installed elsewhere I’d remove it.
How to check Google Analytics is installed correctly.
You can use a simple little Chrome browser extension to check the code is installed correctly and tracking visitors.
Select Add to Chrome
Then you will get a message telling you that Tag Assistant has been added to your Chrome browser.
Now visit your website and click the little blue Tag Assistant icon on your browser bar.
At this stage, just select Google Analytics from the list of tracking options and choose Validate All Pages then press Done.
Now choose Allow and Record and click a few pages on your website to validate the tracking code.
Hopefully you will get the message displaying your Google Analytics ID number.
Double check that number is correct by visiting Google Analytics.
That’s you installed Google Analytics for WordPress and validated the tracking code is working.
The alternative is to install a WordPress plugin to up Google Analytics.
Add Google Analytics with a plugin
There’s lots of Google Analytic plugins but I chose Google Analytics Dashboard for WP.
You connect the plugin to your Google Analytics account and select the view you want to display on the dashboard.
This is so you get traffic reports on your dashboard.
Go to Plugins – Add New Plugins
Type Google Analytics Dashboard into the search box
You’ll see Google Analytics Dashboard for WP by Exact Metrics (formerly GADWP)
Google Analytics Menu will appear on the bottom left of WordPress
Select General Settings
You can select Authorise Plugin and you’ll see this screen below asking you to Get Access Code.
Then click Get Access Code
(you need to already have a Google Account and Analytics set up)
Select your Google Account containing your Google Analytic profile
In my case I select my email account that’s connected to my Analytics
Then select Allow
Then you’ll get a screen with a code – copy the code.
Now go back into WordPress with the Access Code panel visible and enter the code and press Save Access Code.
Now you’ll get this screen.
- You want to check the correct website profile view is select
- Check the default URL is correct and the tracking ID is correct
- Change the theme colour to match your brand (optional)
- Save Changes
That’s you connected Google Analytics to WordPress with a plugin.
Just click dashboard on the top of the left hand menu nd you will have a Google Analytics dashboard on your WordPress Dashboard.
Google Analytics dashboard
My default view is last 30 days and Organic Traffic as above but another option is the last 30 days traffic; total website traffic.
This shows traffic sources displayed in an organisational chart.
Along with pie charts showing a breakdown of each channel.
Last 30 days and 404 errors; good for checking broken links.
Last 30 days and Technology; good to check visits by device type
One Year and Location
A nice map showing where your visitors came from.
Last 90 Days and Pages
This is basically the All Pages report in Google Analytics
It’s basic but useful information.
My biggest issue with the plugin is that I can’t compare month to month or see conversion rates.
I trust this guide was useful in setting up Google Analytics for WordPress.
I go into more detail in SEO Box Training if you want to learn more.