Last Updated on
How to add Google Analytics to WordPress
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 they visit the most
- and many other things
Which you can check with the help of free tool “Google Analytics”.
So, today I am going to help you to add Google Analytics to your WordPress website.
Don’t worry its easy to set up, just follow the article till the end.
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 checkbox and done. That’s the first step, now come 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 wants to check the stats 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 timezone 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 for better results:
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 tracking id otherwise you can check both.
Here you can enable or disable demographics or link attribution settings.
You can also add URL for cross-domain tracking.
These settings are 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, to save settings and to exclude 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 host google analytics locally which means your page speed/performance are 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
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 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. How to Check Stats
After all the steps are done, wait for a few hours for google analytics to analyse and collect the data.
- You can check your stats in your admin dashboard with MonsterInsights.
- Also, check directly from google analytics site.
- Download google analytics app in your mobile and log in with the same id to check the stats directly from your mobile.
That’s all, hope you guys now understand how to add google analytics to WordPress. If you still face any problem then don’t hesitate to comment below your issues.
People also search for:
Ajmer Singh is the Founder & Author of Findmytricks. He is a passionate blogger and with the help of his articles, you can learn WordPress & Blogging in a simple way.
CONTACT: [email protected]
1. “Be yourself. Everyone else is already taken.”
2. “First, learn the rules, then break them”