
Successful marketing campaigns are based on data. If you have detailed data on your website visitors, you can customize your marketing campaigns to attract targets and convert them into leads.
Tracking visitors is an essential aspect of running an online business. Hence, there are many popular tools that help you track visitors and generate detailed segment reports on various web traffic analysis parameters. Among these tools, Google Analytics for WordPress is an excellent choice for analyzing visitor trends and traffic sources.
When you install Google Analytics on WordPress, you get detailed insights into your website and user behavior (such as page views, time spent on pages, bounce rate, traffic source, etc.). And experts recommend opting for the best WordPress hosting providers to use these insights for exemplary performance results.
Power up the Game of Hosting Today!
Discover a hosting revolution where downtime is a myth and customer support isn’t a punchline.
This article will discuss why you should use Google Analytics and the steps to set it up on your WordPress website.
Why Should You Set Up Google Analytics?
In this data-centric age, any tool that provides detailed information on website visitors is essential to your website. And a tool like Google Analytics that tracks visitors and their journey (such as search engines, ads, click-to-pay networks, email marketing, PDF, and onsite/offsite links) is a must-have for anyone seeking growth.
In particular, Google Analytics tells you:
- Who visited your website and when
- What visitors are doing on your website
- How visitors discover your website
- How visitors interact with your website content
Additional information includes visitor geo-location, browsers, default language, screen resolution, JavaScript support, etc. This user data is incredibly useful for developing strategies and helps you with website customization (such as theme and menu placement) and future website improvements.
How to Create a Google Analytics Account
Any user can easily install Google Analytics on a WordPress website regardless of their technical background.
You’ll find how easy the steps are as I demonstrate how to set up Google Analytics on WordPress websites.
Also, we have covered a detailed guide on integrating Google Analytics with WooCommerce.
So, let’s get started!
While there are many ways of integrating Google Analytics with WordPress websites, the steps mentioned remain the same for all methods.
Step 1: Create a Google Analytics Account
You need to create a Google Analytics account. For this, go to analytics.google.com. From there, two cases arise:
- You already have a Google account: Log in with your credentials.
- You don’t have a Google account: Create a new account by clicking the “Create account” button. Fill up the information, including your name, email address, password, and related information (date of birth, mobile number, location, etc.).
- Once you’ve created your Gmail account, open the Google Analytics homepage and click the Start measuring button.
- You will see the Account Setup screen.
- Fill in the account name and select the Account Data Sharing options.
- Click Next.
- You will see the property setup screen that lets you choose the reporting time zone, currency, and name.
- Fill in the information and click Next.
- You will see the About your Business form that asks you to select your industry category, business size, and the intent to use Google Analytics.
- Once you click the Create button, the Google Analytics Terms of Service Agreement popup will appear, prompting you to accept their terms and conditions.
- In data streams, choose your preferred platform to collect the data.
- Set up the data stream by adding your Website URL and Stream name, then click on the Create Stream button.
- You’ll see the Web Stream Details screen, showing that the web stream is created, but the data collection isn’t integrated and active, indicating you to install Google Tag on your WordPress site.
And here’s how you can add a Google tag:
Click the View Tag Instructions button, and you’ll see two ways to add the tag:
1) Install with a website builder or CMS.
2) Install manually.
When you add the tag to your website, Google will start tracking the data to your Analytics dashboard.
4 Easy Methods to Add Google Analytics to WordPress
You can install Google Analytics tracking code on your WordPress website via four different methods. I have listed all four below:
Method 1: Add Google Tag Code to Header.php
You can add Google analytics to WordPress by simply copying/pasting the Tracking Code to your website code (in the “header.php” file).
Follow the steps below:
- Go to the WordPress Dashboard.
- Click Appearance → Editor.
- Click the “header.php” file to edit its code.
- Copy the “Tracking Code” from Google Analytics and paste it into the header code. Ensure to paste the code right before the </head> tag.
- Once it’s done, wait for a few hours, as the installation can take up to 48 hours to fully activate.
Method 2: Install the Google Analytics WordPress Plugin
Installing Google Analytics via a plugin is an excellent alternative if your theme restricts you from using the first method.
The process requires installing a WordPress Google Analytics plugin. And since the WordPress plugin repository offers multiple solutions, I’ve mentioned the two best Google Analytics WordPress plugins to help you do the job without any fuss.
1. Google Analytics Dashboard for WP
GA Google Analytics is a simple, well-coded, and powerful plugin. Follow the steps below to install GA to your WordPress site.
- Go to your WordPress Dashboard.
- Click Plugins → Add New.
- Type “GA google analytics” in the search box.
- Click the “Install Now” button and then “Activate” the plugin.
- Configure the plugin once it is activated.
- Go to Dashboard → Settings → Google Analytics.
- Click Plugin Settings.
- Copy and paste the “Tracking ID” you find on the “Google Analytics Tracking Code” page (see previous screenshots).
- You must check the “Universal Analytics / analytics.js” and “Include tracking code in page head (via wp_head)” boxes that set up Google Analytics on the WordPress website.
- Click the “Save Changes” button.
2. MonsterInsights
Google Analytics for WordPress by MonsterInsights is another popular Google Analytics WordPress plugin. It is a freemium plugin and is widely used because of its easy-to-use interface.
- Install and activate the plugin by following the same steps shared in the previous method.
- Navigate to the plugin’s settings page to link it with your Google Analytics account.
- Click the “Connect MonsterInsights & Setup Web Analytics” button and run the MonsterInsights setup.
- Select your site’s category.
- I’m using a free version of MonsterInsights that doesn’t require any license. You can opt for the pro version if you want to enjoy the plugin’s premium features.
- Connect & authenticate your Google account with MonsterInsights.
- After authenticating your Google account with MonsterInsights, click Save & Continue on the recommended settings & features screen.
- Once the setup completes, the plugin takes a few minutes to fetch tracking data and displays the live tracking data in the WordPress dashboard.
Note that a few options are restricted in the free version. But the pro version comes with options such as forms and multiple other features.
Method 3: Using Google Tag Manager
Another method to add Google Analytics to a WordPress website is using a Google Tag Manager. Follow the steps below:
- Go to your WordPress dashboard.
- Click Plugins → Add New.
- Search for “google tag manager” in the text field.
- Install and Activate the plugin.
- Visit Google Tag Manager and click on the “Create Account” button if you have not already signed up.
- Enter the required details, including Account Name, Country, and Container Name, and click the Create button.
- Read the Google Tag Manager’s Terms of Service Agreement and mark the agreement to continue.
- Once you complete the signup process, you will see the Google Tag Manager snippets.
- Click the OK button to get your Google Tag Manager ID.
- Go back to the plugin’s settings, and paste your Google Tag Manager ID.
- Click the Save Changes button.
- Congratulations! You have successfully installed Google Analytics via Google Tag Manager.
Method 4: Hosting WordPress Google Analytics Locally
If you don’t prefer any of the three methods mentioned above, there’s another one for you: local hosting.
Google Analytics can be hosted locally on your server for better performance as it reduces external HTTP requests. To integrate this functionality, I will use a lightweight WordPress Google Analytics plugin, Complete Analytics Optimization Suite, developed by Daan van den Bergh.
Follow the steps below:
- Head over to the WordPress dashboard.
- Click Plugins, and search for “CAOS.“
- Install and activate the plugin.
- Navigate to the plugin’s settings page.
- Enter the Google Analytics Tracking IDe and select the location to place the tracking script.
Make Sure Google Analytics Works Well
Once you have integrated Google Analytics with your WordPress site, the next step is to verify the integration.
You can easily test the Google Analytics integration with your site by following the steps below:
- Go to Google Analytics.
- Click Real-Time → Overview.
- Visit any page of your WordPress website.
- If Google Analytics is connected to your website, you will see a bar indicating your website data goes back well in Google Analytics.
Note: It may take some time before the data is reflected in Google Analytics.
Wrapping Up!
This blog has shared the easy steps of setting up a Google Analytics account and integrating it with your WordPress website.
You can refine your site’s data analysis by editing Google Analytics’configuration options and creating different profiles by playing with filters, creating objectives, or even setting up events/tracking ecommerce.
These configurations will allow you to analyze traffic and help improve conversion rates. In case of any questions, do not hesitate to ask us for advice in the comment section.
Frequently Asked Questions
Q: How to add Google Analytics WordPress?
A: You can add Google Analytics to WordPress by setting up a Google Analytics account and pasting the tracking code inside your site’s header file. You can also add Google Analytics by using a plugin like GA Google Analytics or any other Analytics integration plugin.
Q: How to add the Google Analytics WordPress plugin?
A: Follow the steps below to add the Google Analytics WordPress plugin:
- Go to your WordPress dashboard.
- Click Plugins > Add New.
- Search for the desired plugin.
- Install and activate the plugin.
- Navigate to the plugin’s setting page and connect it with your Google Analytics account.
Customer Review at
“Beautifully optimized hosting for WordPress and Magento”
Arda Burak [Agency Owner]
Farhan Ayub
Farhan is a community manager at Cloudways. He loves to work with WordPress and has a passion for web development. Mostly, he spends his time interacting with the people in the WordPress community. Apart from his work life, Farhan spends his time gaming and playing sports. Feel free to contact him at [email protected]