Table of Contents
Looking at how to add Google Analytics to WordPress? There are two major approaches:
- Manually without plugins. Technically, you’ll need to get your Google Analytics code snippet and insert it into your WordPress website (we’re going to tell you where). Then you’ll be able to access the Google Analytics dashboard from your Google Account online in one place. The major benefit of this approach is that it doesn’t require reliance on third-party dependencies. As for the cons, for complete newbies, it might be a bit intimidating to work with code and the entire procedure might require additional time and effort.
- Integrate Google Analytics by connecting WordPress Google Analytics plugins. You might want to opt for this method if you want an easier way to connect Google Analytics to WordPress, need more tools, or (thanks to some plugins) access your Analytics dashboard from your WordPress website.
If you are here, most likely you already know the benefits Google Analytics provides: this is one of the most powerful analyzing tools to measure the performance of your entire website.
Quick tip: If you’re working on your WordPress website and edit content in Gutenberg, Getwid WordPress blocks might be a great way to enhance your customization opportunities.
Let’s break up our post into several parts:
- The benefits of data-driven insights of Google Analytics
- How to start with Google Analytics?
- How to add Google Analytics to WordPress without plugins?
- How to install Google Analytics on WordPress with a plugin?
The benefits of data-driven insights of Google Analytics
To get used to Google Analytics and to discover all the insights and the ways to work with it, you need a lot of time. Here are the basics that will help you study and understand your customers/readers and learn from the stats:
- Real-time stats on your page sessions, traffic, sales and more
- Learn your audience
- Traffic sources: learn where your visitors came from/how they found your website (external link, social media, etc.)
- Geographical data about your audience to tailor your marketing targeting
- Customer segmentation by different factors
- To see which social platforms work the best for
- Check most visited pages to understand how to plan your content strategies/product releases
- Compare traffic stats with that of your competitors
- Learn the bounce rate, or why people leave your website
- Create and track marketing campaigns
- Learn which technical things on your website must be improved.
And this list can surely be extended but we have to get down to practice.
How to start with Google Analytics?
Log into your Google account and then go to the Google Analytics page to sign up and create an account.
If you are already logged in, you’ll be redirected there right away so you can click on the “Set up for free” button and follow the further instructions on setting up your first “web property” as it’s called in Google Analytics:
Then you simply need to fill in the data step by step:
- Create your account name:
2. Select “web” for websites:
3. Insert data associated with your website and click “Create” to finish the procedure:
You’ll be able to later add more web properties in your account. You need to create separate Analytics properties for each website you need to collect data for. When the first property is created, Analytics also adds the first reporting view, with the default name ‘All Web Site Data’. Learn how to read and customize your view.
Once finished, get your tracking ID to further add to your WordPress website to collect data (the code under Global Site Tag).
To get back to the page with the code in your Google Analytics account again, you need to go to Admin (at the bottom left) > select an account > then Property > Tracking Info > Tracking code.
So where to put Google Analytics code in WordPress? Let’s look into several approaches.
How to add Google Analytics to WordPress without plugins?
Pay attention to the code under the Global Site Tag (gtag.js) – these lines of code are all you need to insert in WordPress:
- Copy the entire code.
- Go to your WordPress website – Google Analytics requires you to paste it on every website page. You may just insert the code in the header area of your website (it will load the code on every page of your WordPress site).
You can do this either manually or, again, with a plugin. Let’s start with the manual approach.
In WordPress, it’s safer to apply all modifications to the website files via a child theme. In simple terms, a child theme is not a different theme; it’s a complimentary thing that allows you to add modifications and files to the exciting (parent) theme without worrying they’ll disappear once you update the main theme. You can google for any suitable guide.
Now you need to paste your Google Analytics tracking code into the header.php file accessible via FTP (if you are working with the child theme, you firstly need to copy the header.php from the parent theme). Paste the Google Analytics tracking code right before the <head>, save file and upload it to your server.
If you want to skip the manual tweaks of editing template files, paste the code using the Insert Headers and Footers free plugin.
Once you installed and activated this supporting plugin, follow the prompts to start configuring it. It will bring you to the header and footer scripts so you just need to simply paste the Google Analytics tracking code into the Header area:
Simpler than you could have ever imagined!
How to install Google Analytics to WordPress with a plugin?
There are tons of plugins that won’t only help you add the code but also configure the main settings, bring Google Analytics to your WordPress dashboard, extend the default functionality further and optimize the way you work with the Google Analytics data. They require the post of their own since there are loads of plugins and a lot of things to compare.
For the purpose of this guide, let’s stop on one free solution that would help you integrate Google Analytics the easy way and at the same time will help you benefit from its extra features.
We love how the Google Analytics Dashboard for WP by ExactMetrics works – it offers you the intuitive way to add the WordPress Google Analytics Tracking code and is jam-packed with useful tools. The plugin is trusted by a million people so you can be sure this solution works for others.
Upon the installation, the plugin will ask you to authorize the plugin and add the code so you will install Google Analytics in no time automatically.
The tracking starts immediately to provide you with the relative data, including downloads, 404 error page hits, and more. The plugin will allow you to view all the stats from your WP dashboard (e.g. some key real-time metrics like traffic sources, acquisition channels, and more). Thanks to the built-in filters, you’ll be able to identify your customers from the outset.
For testing purposes, we didn’t input the code but let’s have a quick guide through the tools:
- The plugin allows you to configure the settings as to who can view the stats, some real-time stats, announcements:
- Set up event tracking tools.
- Integration with WordPress AMP and e-commerce, etc.
Verify that the Google Analytics tag is working
Regardless of the way you chose for inserting the code to collect data about your website, you need to make sure that the Google Analytics WordPress works properly to see results in the way we’ve shown at the beginning.
Visit your website and check whether your visit is being displayed in the real-time report.
Conclusion: WordPress Google Analytics is a must-have tool
You can easily add Google Analytics to WordPress either with a plugin, manually, or even by applying both methods. You are literally blind to how your online business performs without data and insights of this service; everything is so much easier with data-driven strategies.
It costs you almost nothing to connect and use the service so don’t procrastinate and install Google Analytics on WordPress as soon as possible. You already have our WordPress Analytics guide for this! What do you think is the easiest way to set up Google Analytics on WordPress? Share your favorite tools with us.