Google Analytics (GA) is one of, if not the most common form of web performance tracking tools available. WordPress is also the most commonly used Content Management System, or CMS, used today. Knowing how your audience interacts with your website’s content is critical to your ability to improve your site as well as your site’s overall success.In this guide I am going to show you a number of ways how to set up Google Analytics on WordPress.
Before we get in to setting up GA on your WordPress site. Let’s find the codes you’ll need to do so.
- In your Google Analytics account, you’ll notice in the lower left corner there is a gear that says “ADMIN” next to it. Click that gear.
- You will then be brought to your admin page where there are 3 columns: Account, Property and View.
- Under the Property column you should see your website name if you’ve already set up your GA account.
- Click the “Tracking Info” link in that column:
- Then click “Tracking Code”.
Method #1: Use a Plug In (UA Code)
There are dozens if not hundreds of plug ins available to implement your Google Analytcs code onto your WordPress site. My recommendation here is to choose an SEO plug in that does far more than just GA code implementation. That way you don’t have to have 2 plug ins to accomplish what you can do with just 1. At the end of the day, the more plug ins you have the slower your site will load, so less is always more when it comes to WordPress plugins.
Recommended Plug In: All In One SEO
To install the All In One SEO plug in you need to either navigate to the plugins page in your WordPress dashboard by hovering over the “Plugins” tab in your left sidebar and clicking “Add New”.
This will lead you to the Add Plugins page. In the upper right hand section of that page you will see a search bar that has a box that says “keyword” in it and a search box with “Search plugins…” placeholder text.
Simply start typing in “All In One SEO” and the page will start updating with relevant results. By the time you type out “All In One” you will likely see the plug in appear.
You will see a box that looks like this:
However where it says “Active” in the top right, it will say “Install Now”.
Go ahead and click install now, then once it finishes installing click “Activate”.
Once activated you will notice in the top left of your WordPress sidebar there is a tab for “All In One SEO” just below the Dashboard link.
Go ahead and hover over that and click “General Settings”.
Now All In One SEO is a very powerful and robust plugin with tons of great features. I am going to write a separate post on how to best configure these settings for improving your website’s SEO. For now though, we are just setting up Google Analytics on your WordPress site.
On the General Settings page you’ll want to scroll down about halfway until you see a heading that reads “Google Settings”.
Scroll down just a little further until you see “Google Analytics ID” just below the Specify Publisher URL field and just above the Advanced Analytics Options field.
Paste the UA code that you found earlier in that Google Analytics ID field, check the “Advanced Analytics Options” button to Yes, scroll down to the bottom of the page and click the blue “Update Options” button the the bottom left of the page.
And your done! You now have Google Analytics fully implemented across your website.
Warning: This is only for advanced users. You will be directly editing your website’s core code.
For this method you will need 2 things:
- A text editor, such as sublime text or notepad
- An FTP Client
Steps for Google Analytics code implementation:
- Next, connect to your site via FTP (Your web host should have set this up for you).
- Navigate to your theme folder by clicking Wp-Content -> Themes -> [Your Theme Name]
- Inside the [Your Theme Name] folder you will see a file titled header.php.
- Download that file and open it in your text editor
- Save As… that file as header-original.php and set it aside.
- Now re-open the header.php file you originally had opened. The code should be identical. Just a different filename.
- Save the header.php file and re-upload it back to your theme file that you downloaded it from.
This should replace the old header.php with the new one – which is exactly the same + a Google Analytics code.
Now open your site and open Google Analytics to test 2 things:
- Your visit is being tracked
- You didn’t break anything by messing with header.php.
Something go wrong?
If you broke anything, you have a backup saved of your header.php. Simply paste that original code back into the header.php you have saved locally, replacing all the code that was there with the original code, and save. Then re-upload header.php again.
Wrapping Things Up
There are more ways to install Google Analytics on WordPress and I will add them to this post later. However if you are just getting started, I highly recommend going with the plug in option. You have far less chance of messing anything on your site up this way and the work is significantly less.
I hoe you found this guide helpful. Should you have any questions or concerns, please feel free to leave them in the comments box below. I’ll get back to you as soon as I can.
Leave a Reply
Your email is safe with us.