How To Add and Install Google Analytics To WordPress in 2023

Last Updated on 28th December 2022 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. 

How to add and install Google Analytics to WordPress

1. Create an account with Google Analytics

First of all, you need to visit google analytics and sign up with your Google account.

add and install google analytics
Google Analytics account – FindMyTricks
add and install google analytics
Google Analytics account setup – FindMyTricks

Fill up your account name (anything you want) then click all the checkboxes and be done.

Let’s move on to the second step.

add and install google analytics
Google Analytics web – FindMyTricks

Now in the next step, you can see 3 things:

  1. WEB – If you want to check stats for your website then click here.
  2. APPS – This option is for app owners who want to check the statistics of their apps.
  3. 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.

add and install google analytics
Google Analytics create account – FindMyTricks

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.

add and install google analytics
Google analytics terms of service – FindMyTricks

Read their terms and conditions, click them and continue.

add and install google analytics
Google Analytics tracking code – FindMyTricks

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:

  1. MonsterInsights
  2. CAOS
  3. Themify Ultra Theme

2. Connect with MonsterInsights

First, you need to activate and install the plugin.

add and install google analytics
Google analytics monster insights settings – FindMyTricks
add and install google analytics
Google analytics monster insights settings – FindMyTricks

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.

add and install google analytics
Google analytics monster insights settings – FindMyTricks
add and install google analytics
Google analytics monster insights settings – FindMyTricks

Engagement

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.

add and install google analytics
Google analytics monster insights settings – FindMyTricks
add and install google analytics
Google analytics monster insights settings – FindMyTricks
add and install google analytics
Google analytics monster insights settings – FindMyTricks

eCommerce, Publisher & Conversions are premium options for which you have to pay. So leave this for now.

add and install google analytics
Google analytics monster insights settings – FindMyTricks
add and install google analytics
Google analytics monster insights settings – FindMyTricks
add and install google analytics
Google analytics monster insights settings – FindMyTricks

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 host 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.

add and install google analytics
Google analytics caos settings – FindMyTricks

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

add and install google analytics
Google analytics caos settings – FindMyTricks

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

add and install google analytics
Google analytics caos settings – FindMyTricks

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.

add and install google analytics
Google analytics themify ultra settings – FindMyTricks

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.

  1. You can check your stats in your admin dashboard with MonsterInsights.
  2. Also, check directly from the google analytics site.
  3. 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.