How To Add Google Analytics To WordPress 2023
Last Updated on 30th May 2023 by Ajmer Singh
Every website owner wants to check:
- visitors location
- bounce rate (for how much time they stay on your website)
- return visitors
- organic, direct, or social visitors
- which page/post do they visit the most
- and many other things…
You can check all these and more with the help of the free tool “Google Analytics”.
So, today I am going to help you to add Google Analytics to your WordPress website.
Don’t worry it’s easy to set up, just follow the article till the end.
A Comparison Chart of Different Methods
If you’re looking to gather valuable insights about your website’s performance and visitor behaviour, integrating Google Analytics is crucial.
In this chart, we’ll explore three distinct methods: Manual Code, MonsterInsights, CAOS (Complete Analytics Optimization Suite), and Themify Ultra.
Each method offers its own set of advantages, varying in difficulty, time required, cost, and the need for plugins.
Let’s dive in and discover the best option for your Google Analytics integration needs.
|Method||Difficulty||Time Required||Cost||Plugin Required?|
|Manual Code||Moderate||10-15 minutes||Free||No|
|Themify Ultra||Easy||1 min||Paid||No|
How to add and install Google Analytics to WordPress
Google Analytics is a powerful tool that provides valuable insights into your website’s performance, visitor behaviour, and marketing effectiveness.
Integrating it with your WordPress site allows you to track important metrics and make data-driven decisions to enhance your online presence.
In this guide, we’ll walk you through various methods and plugins to seamlessly incorporate Google Analytics into your WordPress site.
Whether you prefer manual coding or using dedicated plugins, we’ve got you covered.
Let’s explore the different options to get you started with Google Analytics on WordPress.
1. Create an account with Google Analytics
First of all, you need to visit google analytics and sign up with your Google account.
Fill up your account name (anything you want) then click all the checkboxes and be done.
Let’s move on to the second step.
Now in the next step, you can see 3 things:
- WEB – If you want to check stats for your website then click here.
- APPS – This option is for app owners who want to check the statistics of their apps.
- APPS & WEB – This option is for both website and app owners.
For now, we are here to check website stats, so click on the WEB and come to the next step.
In this last step, you have to enter your website details.
Website name – You can fill up anything you want.
Website URL – Enter your URL with Http/Https.
Industry category – Choose your website category.
Reporting Time Zone – Your country’s time zone or whatever you want.
Read their terms and conditions, click them and continue.
On the next page, you will get your tracking Id and code.
Copy the tracking id for later.
You can use the code to enter manually in the header or footer,
but I prefer to use the tracking Id with the help of these two plugins or a theme for better results:
- Themify Ultra Theme
2. Connect with MonsterInsights
First, you need to activate and install the plugin.
Settings – General
You can connect google analytics with MonsterInsights or manually enter your tracking Id.
I prefer manually entering the tracking id otherwise you can check both.
Here you can enable or disable demographics or link attribution settings.
You can also add a URL for cross-domain tracking.
Do these settings as per your need.
Leave blank or default if you don’t know about these options.
eCommerce, Publisher & Conversions are premium options for which you have to pay. So leave this for now.
Here you can give user role permissions to see reports, save settings, and exclude them from tracking.
Enable or disable the dashboard widget and reports.
Show or hide admin bar reports.
Enable or disable automatic updates.
Show or hide announcements.
Allow or disallow usage tracking.
3. Connect with CAOS (Host google analytics locally)
This plugin hosts google analytics locally which means your page speed/performance is not affected by external requests.
This plugin can create a folder anallytics.js which you can cache and optimize.
Activate and install the plugin.
Enter your google analytics tracking Id.
Allow tracking – always
Snippet type – default
Enable compatibility mode – Leave blank or choose MonsterInsights if you want both plugins.
Stealth mode – disable
Which file to download – analytics.js
Save analytics.js to – leave this as it is
Position of tracking code – Header
Serve from a CDN – if you are using CDN then enter the URL here otherwise leave blank. (not for Cloudflare users)
Capture outbound links – this is used to track “when users leave your site or click on outbound links on your site”.
This only works if you choose the analytics.js file for download and disable stealth mode.
Cookie expiry period – you can set a cookie (in days)
use adjusted bounce rate – for now, leave this blank
Change enqueue order – 0
Disable all display features functionality – leave
Anonymise IP – disable
Track logged-in administrators – disable
Remove settings at uninstall – Enable if you want all the settings to be removed after the uninstallation.
Save changes and done.
4. Themify Ultra
If you are using the Themify Ultra theme (recommended), then you can directly add the google analytics code to the theme settings.
No need to install an extra plugin and load your server.
Themify Ultra – Themify settings – General – Google analytics.
5. How to Check Stats
After all the steps are done, wait for a few hours for google analytics to analyze and collect the data.
- You can check your stats in your admin dashboard with MonsterInsights.
- Also, check directly from the google analytics site.
- Download the google analytics app on your mobile and log in with the same id to check the stats directly on your mobile.
That’s all, hope you guys now understand how to add google analytics to WordPress.
Having issues connecting google analytics, comment down – let me help you.