How to Add Google Analytics to WordPress

How to Add Google Analytics to WordPress the Right Way (2024)

Are you looking for instructions on how to add Google Analytics to WordPress? Want to know how people are finding your site, which blog posts are most popular, how many eCommerce sales you’re making, how many of your visitors are using mobile devices, and a whole lot more?

When you have data about how your users navigate your site, you can optimize it to get more traffic and make more money. The best part? All of the analytics data you need can be easily tracked and found using Google Analytics and MonsterInsights.

In this article, we’ll show you how to add Google Analytics to your WordPress site using MonsterInsights, the best Google Analytics plugin for WordPress.

Add Google Analytics to WordPress without Coding

MonsterInsights is the best WordPress Analytics plugin. Get it for free!

Table of Contents

  1. Why Use Google Analytics?
  2. Google Analytics + WordPress: The Basics
  3. Video Tutorial
  4. How to Add Google Analytics to WordPress
  5. View Your Google Analytics Metrics in Your Dashboard
  6. Use Conversations AI For Analyzing Google Analytics Data (NEW)
  7. Google Analytics for WordPress FAQ

Why Use Google Analytics?

Using Google Analytics is the best way to track your website visitors. It’s the top website analytics tool because it’s made by Google, it’s free, and it can tell you everything you need to know about your visitors so that you can grow your business or brand.

At its most basic level, Google Analytics tracks:

  • How many people visit your site, plus where (geographically) they visit from
  • Which of your website’s pages your visitors land on
  • How many views all of your web pages get
  • Which traffic channels visitors use to find your website (search engines, email, social media, referrals from links on other websites, etc.)
  • Which browsers and devices visitors are using when they visit your site
  • How long users spend on your site
  • And more

Beyond those tracking features, you can track more metrics by tinkering with other settings.

For example, if you choose which interactions with your website are the most important, you can create conversions (also called key events) to track how often those important actions are happening.

Or if you sell products or services on your website, you can set up eCommerce tracking to track views of your products, total revenue, abandoned checkouts, and more.

Other added tracking features you can set up include:

Although Google Analytics allows you to track many things, setting up that extra tracking and/or reading your reports and finding your data can be challenging.

Keep reading for our solution to that!

Google Analytics + WordPress: The Basics

Google Analytics can measure many different metrics on a WordPress website. You can turn WordPress into just about any kind of website, and Google Analytics can track it.

The way you use Google Analytics on WordPress will differ depending on what kind of website you have.

If you have a blog, maybe you’re most interested in which posts people are reading, how they found the posts (on social media? via a referral from another site? via Google search?), and if they’re clicking on ads or affiliate links.

If you have a business website, on the other hand, maybe you’re most interested in how many people are filling out your forms, how they’re finding your website, and which of your services are the most popular.

You need to install the tracking code to connect Google Analytics to any website to track page views and all of your visitors’ behavior. The code should be placed in your header.php file just before the closing </head> tag in your header.

For beginners and many people without coding experience, this is not easy to do. Most WordPress website owners aren’t developers and don’t know how to work with code!

That’s where MonsterInsights comes in. The plugin makes installing Google Analytics on WordPress a breeze with zero coding and adds crucial tracking features to help you understand how people use your website and a whole Google Analytics dashboard right inside your WordPress admin.

MonsterInsights seamlessly integrates with Google Analytics 4 (GA4), giving you the ability to view your GA4 reports in an easy-to-understand way.

Video Tutorial

How to Add Google Analytics to WordPress

Step 1: Download MonsterInsights

Normally, you’d have to insert your Google Analytics tracking code into your WordPress website’s code.

But with MonsterInsights, you don’t need to worry about using any code.

MonsterInsights is the best Google Analytics plugin for WordPress. It allows you to easily connect your WordPress site with Google Analytics so you can view all the data that matters most right in your WordPress dashboard.

MonsterInsights Home Dashboard

Plus, with the click of a button, you can set up sophisticated tracking features such as event tracking, eCommerce tracking, form tracking, custom dimension tracking, outbound link tracking, PPC ad tracking, and much more.

To get started, head to the Pricing page and choose the best license level for your tracking needs. Once your license is active, download the plugin zip file from your account page.

download monsterinsights

Just getting started with Google Analytics and not sure what your tracking needs are just yet? You can start with the most basic version of MonsterInsights for free.

Step 2: Sign In to Google

Now, you need to log in or sign up for a Google account.

To get started, you’ll need to open the Google Analytics website and click the Sign in to Analytics link or Start for free button in the top right corner of the page.

Sign in to Google Analytics

Next, you can log in to your existing Google account if you have one, or click the Create account link to create a new Google account.

Sign in to Google Analytics 2024

Step 3: Create a Google Analytics Property

After you’ve signed in to your Google account, click the Start measuring button on the next screen. click start measuring

Now, you’ll need to enter the Account name for your Google Analytics account. You’ll also see different data sharing settings, make sure you check all the boxes and then click Next.

GA create an account

Now, you’ll have to enter the property details of your website. Start by entering a name and selecting a reporting time zone and currency.

To set up a GA4 property, enter your property name, then choose your time zone and currency. Click Next.

GA4 setup step 1

Choose your industry category and your business size, then click Next.

GA4 setup step 2

Finally, choose your business objectives. We suggest choosing Get baseline reports so that you get all of the Google Analytics reports populated in your account.

Google Analytics setup step 3

Click Create.

That’s it! You’re now signed up for Google Analytics. Next, we’ll add Google Analytics to WordPress.

Note: You do not need to move ahead to the create stream step – MonsterInsights will do that for you!

Step 4: Set up MonsterInsights

Navigate to the site where you want to install MonsterInsights and go to the WordPress admin dashboard.

Then navigate to Plugins » Add New and click the Upload Plugin button at the top.

Upload Plugin Button in WordPress

On the next screen, click the Choose File button to select the zip file you downloaded in step one. Then click the Install Now button to upload the file and install the plugin on your site.

Install MonsterInsights

Once the plugin has been uploaded and installed, click the Activate Plugin button to activate it on your site.

Activate MonsterInsights Plugin

After the plugin is activated, the plugin setup wizard will open to guide you through the setup process step by step.

At first, you’ll see the “Welcome to MonsterInsights!” message and options to choose the category of your website. There are 3 options: Business website, Publisher (Blog), and eCommerce.

MonsterInsights Setup Wizard - Choose Your Website Category

Select a category that best describes your website, then click the Save and Continue button.

If you want to skip the setup wizard for now, you can click the Exit Setup button at the top.

In the next screen, you’ll need to connect the MonsterInsights plugin to your website by providing your license key.

Enter Your MonsterInsights License Key to Connect with WordPress

You can find your MonsterInsights license key in your email receipt or your account area on the plugin website.

Once you enter your license key, it’ll verify your account, and then you can click on the Connect MonsterInsights button.

After that, you’ll see an option to connect your Google Analytics with your MonsterInsights account. Select your account to continue authentication.

Choose a Google account to sign in with MonsterInsights

Next, you’ll need to click Allow to allow MonsterInsights the proper permissions.

MonsterInsights Google Permissions

After that, you’ll need to pick a profile to complete the connection. If you have multiple websites connected to your Google Analytics account, then you’ll need to choose the right website property here.

Choose your profile, and then click the Complete Connection button.

After that, it’ll finalize the authentication process in a few seconds and then take you back to your MonsterInsights setup page.

Now, you can see the recommended settings for the Google Analytics plugin.

MonsterInsights GA Plugin Recommended Settings

This page includes some of the most important settings as the following:

  • Events tracking – Enabled by default.
  • Enhanced Link Attribution – Enabled by default.
  • File Download Tracking – Most used file types (doc, exe, js, pdf, ppt, tgz, zip, xls) added by default.

As you scroll down, you’ll see more settings.

MI Setup - second part

  • Affiliate Link Tracking – It has 2 affiliate link paths added by default, and lets you add more affiliate link paths.
  • Access to MonsterInsights Reports – You can choose who can see the MonsterInsights reports.
  • Automatic Plugin Updates – You can enable or disable the option to install updates automatically.
  • Show MonsterInsights Badge – Choose whether or not you want to show a MonsterInsights badge in your website’s footer. You’ll be able to access a few options for how this looks later.

Review and configure these recommended settings, and then click the Save and Continue button at the end.

On the next screen, you’ll see options for even more tracking options, addons, and helpful plugins.

MonsterInsights features to enable

The first four items are:

  • Standard Analytics & Reports – The standard MonsterInsights reports you’ll get in your WordPress dashboard.
  • Enhanced Link Attribution – This can help you see where users click on your site.
  • Add Recommended Plugins To My Website – We recommend adding four plugins to your website here. Check this option to install all four or expand it to pick and choose from the plugins:
    • UserFeedback – Ask visitors questions about how they use your website, what content they prefer, what you could improve, or anything else you want to know.
    • All In One SEO – The best WordPress SEO plugin that integrates with MonsterInsights
    • Conversion Tools – Get OptinMonster, the #1 conversion optimization plugin to convert your growing website traffic into subscribers, leads, and sales.
    • Smart Form Builder by WPForms – The most popular WordPress form plugin, trusted by over 5 million websites. Easily create contact forms, payment forms, surveys and more.
  • Privacy Compliance Addon – Helps Google Analytics become compliant for GDPR, CCPA, and more

When you scroll down, you’ll find even more options:

  • Advanced Reports – Get access to advanced reports inside MonsterInsights, such as search keywords, a real-time report, publishers and eCommerce reports, and more
  • eCommerce Tracking – Instantly enable eCommerce tracking
  • 20+ Advanced Tracking – Even more advanced tracking, such as author tracking, form conversion tracking, scroll tracking, and more
  • Media Tracking – Enable embedded video tracking. See how many times videos are watched, how far they were watched on average, and more.

After that, you’ll see a new screen with this message ‘Awesome! Tracking and Analytics are All Setup’. It means the setup process is complete, and you’ve successfully installed Google Analytics in your WordPress site.

MI Setup success message

This screen also notifies you about when you can start seeing your website reports. Depending on the size of your website, it can take between a few hours to 24 hours. Don’t forget to click on the Finish Setup & Exit Wizard button.

Step 5: Adjust Enhanced Measurement & Data Retention Settings

Turn Off Enhanced Measurement

If you created your own Data Stream in GA4 (instead of letting MonsterInsights create one automatically), you’ll need to turn off Enhanced Measurement. To do that, go to Admin » Data Streams, then click on your data stream:

Now, click on the switch to turn off Enhanced measurement.

Turn off enhanced measurement

After clicking the switch, a message will pop up asking if you’re sure you want to turn it off. Click Turn off.

Turn off enhanced measurement in GA4

Make sure you don’t have enhanced measurement on! MonsterInsights adds a lot of custom tracking, and leaving this on can result in skewed, incorrect data.

Change Data Retention Settings

By default, your data retention settings will be set to 2 months. If you want to be able to use your data in custom reports beyond 2 months (which most people do), go to Admin » Data Settings » Data Retention:

Data Retention settings in GA4

Now, use the dropdown to change your settings to 14 months:

Set data retention settings to 14 months

That’s it! You’ve successfully added Google Analytics to WordPress the right way.

View Your Google Analytics Metrics in Your Dashboard

As we mentioned above, it can take a few hours for Google Analytics to start collecting data. Wait for some time, and then you’ll be able to view your WordPress website reports right inside your WordPress dashboard.

A quick summary of the website analytics report is available in MonsterInsights’ dashboard widget.

MonsterInsights Dashboard Widget

To view the full reports, you’ll need to visit Insights » Reports from your dashboard. There, you’ll see the overview report first.

MonsterInsights Overview Report

Then, you can view all the other reports by clicking on the tabs/links at the top of the report. Here are just a few types of data you can track using the MonsterInsights plugin:

  • Top landing pages: Which landing pages are most popular on your site plus their bounce rate, conversion rate, and more
  • Link and button click tracking: Which links and buttons are getting the most clicks
  • eCommerce reports: MonsterInsights integrates seamlessly with the most popular eCommerce plugins for WordPress, including WooCommerce, Easy Digital Downloads, MemberPress, and more. Set up eCommerce tracking with a single click.
  • Search Console report: Connect with Google Search Console to see what keywords people are using to come to your site
  • Forms tracking: Which forms are getting the most impressions and submissions
  • Media tracking: Which of your videos are getting watched and how long people are watching them

Also, you can easily track advanced metrics like eCommerce transactions and custom dimensions with MonsterInsights.

In conclusion, MonsterInsights makes it super easy to add Google Analytics to WordPress, monitor user behavior, set up advanced tracking, make your site GDPR compliant, and view reports.

For a full tour of MonsterInsights, check out Your Ultimate Guide to MonsterInsights Dashboard Reports.

Use Conversations AI For Analyzing Google Analytics Data (NEW)

Now that you’ve explored the reports available in your MonsterInsights dashboard, you’ve seen how it’s packed with vital statistics to help your business grow. But wouldn’t it be fantastic if there was an even quicker and more efficient way to access these stats when you need them?

Introducing Conversations AI:

Conversations AI - Graph example

Conversations AI is a powerful tool integrated into your WordPress dashboard. Instead of navigating through various reports and adjusting date ranges, you can simply ask Conversations AI for the specific stat you need.

Whether you want to know the revenue from a particular product, the conversion rate of a specific page, or which campaign attracted the most traffic, just ask Conversations AI.

Add Google Analytics to WordPress without Coding

Google Analytics for WordPress FAQ

How do you add the Google Analytics WordPress plugin?

Follow these 4 steps:

  1. Download MonsterInsights
  2. Create a Google Analytics account or sign in to your existing account
  3. Install the MonsterInsights plugin via your WordPress dashboard and follow the setup wizard
  4. Adjust your data retention settings

How do you add Google Analytics to WordPress without a plugin?

To set up Google Analytics on WordPress without a plugin, you’ll need to add the Google Analytics code to the header file, right before the closing </head> tag. For a full tutorial on adding your tracking ID, check out Add Google Analytics to WordPress WITHOUT a Plugin.

You can also use Google Tag Manager, though setting it up and using it has a pretty steep learning curve and isn’t great for beginners.

Can I add Google Analytics to WordPress for free?

Yes! Install the free version of MonsterInsights by searching for “MonsterInsights” in your WordPress dashboard under Plugins » Add New.

Install MonsterInsights Google Analytics for Free - add Google Analytics to WordPress

Can I add Google Analytics to WordPress using Google Tag Manager?

Yes, you can use Google Tag Manager to install Google Analytics onto your website. It’s not something we recommend for beginners because of the learning curve, but it is possible! You’ll just need to install your Google Tag Manager code in WordPress and create a GA4 tag:

Add GA4 to Google Tag Manager

For a full tutorial, check out How to Add Google Analytics 4 (GA4) to Google Tag Manager.

We hope this tutorial helped you to add Google Analytics to WordPress.

Here are a few more guides you might like to read:

How to Add a Contact Form in WordPress (The Easy Way)
MonsterInsights vs. Google Analytics
Google Analytics 4 eCommerce Tracking Tutorial [WordPress]
16 Best SEO Plugins & Tools for WordPress (Reviewed)
7 Best Free Keyword Generator Tools to Master SEO

Don’t forget to follow us on XFacebook, and YouTube for more free tutorials, reviews, and Google Analytics tips.

Want to Try MonsterInsights for Free?

Enter the URL of Your WordPress website to install MonsterInsights Lite.

Comments

  1. Excited try this, but at the last step it won’t let me select my website. It’ll only let me select the alternative which is All Web Site…..

    1. Hi there,
      That’s the correct view. The default Google view for a website is called “All Website Data”. The heading name of the website is there for users who have more than 1 Google view per property and more than 1 property to help them separate their Google view/properties

  2. Hello MonsterInsights Team,

    I just try this plugin and setup very well in my website by reading this tutorial. It is really useful and working correctly.

    Thank you.

  3. I really appreciate this very complete step-by-step explanation…unusual to get something this good…thank you.

    1. Hi Dilan! Nope, if you follow this tutorial and use MonsterInsights, there’s no need to manually add the tracking code. MonsterInsights handles all that for you, so there’s no need to touch any code.

      1. What happens if you already have GA tracking code implemented on your site? Do you need to remove it? If so, do you lose your historical data?

        1. Hi there,
          Yes you’ll want to remove it. Your historical data is tied to your Google Analytics profile not the actual tracking code, so MonsterInsights will be reporting it’s Google Analytics data into the same place. Thus your historical data will be just fine, and from the point of view of Google Analytics’s reports, the newly collected data will go to the same place as your “historical” data, so on reports like session count it will appear as if nothing changed; the biggest change you will notice is you will be able to get more reporting out of Google, for example in the Top Events area we’ll start adding the outbound link click events (if you have that feature turned on) for example.

          -Chris

  4. Thanks for the explanation, but I still have one concern, if you can help me out. After we successfully set up your plugin, can we normally add new pages on our website? I mean, is the tracking code automatically inserted in all pages that we create after we installed MI plugin?

    Thanks

    1. MonsterInsights automatically outputs the tracking code on all pages/posts created before and after install of the plugin.

      1. And just one question. We have installed the code with MI plugin last week, and I thought that it worked normally. But now I see that we still can’t see age and gender reports. I clicked and confirmed all the needed things in property settings, but still nothing. In the code there is “displayfeatures” line, can this be the reason? I read that this line is not necessary anymore since it can just be toggled in property settings. Any help?
        Thanks

  5. If I already have Google Analytics setup on my website and am using another plugin for e-commerce tracking, can I just uninstall those plugins and install yours?

    1. Of course! Make sure to remove other Analytics plugin while using MonsterInsights. Otherwise, Analytics may double track your traffic.

      You should also try our eCommerce addon, which gives you all the data you need to optimize your eCommerce store for conversions.

  6. If I use your plugin to acquire the tracking code, who owns the google tracking code? Would I have access to the data accumulated to that traffic code (on the google analytics website) if for any reason I choose to delete the plugin? Or would I only have access to the data through my WP dashboard, and only as long as I have your plugin active and installed?

    1. Hey Yaron,
      Thanks for your interest in MonsterInsights and letting us know your concerns. If you decide to uninstall the plugin in future, you can still access your previous tracking data in Google Analytics. It won’t disappear.

      If you want, you can then set up Analytics natively and continue tracking your site without any issues. But you’ll definitely miss the cool tracking features MonsterInsights provides.

  7. I guess it took about 15 minutes before the code started to appear in the source code. It seems to be working now. Thanks for a great plugin guys!

  8. I am setting Monster Insights up for a client now and would like to know what I need the client to do on his end in order for me to authenticate the account. I have full access to the WordPress dashboard but not his GA account.

  9. Hi
    My administrator has installed MI on my Word Press website and I have set up Google Analytics and authenticated MI with my Google Account.

    I want to track outbound links clicked on my website. Do I simply look at the reports in Google Analytics or is there more that I need to do in MI on my website. Thanks

    1. Hi there,
      If you haven’t already you’ll want to turn on tracking for outbound links in MonsterInsights. Then you can view the results in Google Analytics following this guide if you’re a Lite user, and if you’re a Plus or Pro level MonsterInsights user, you can view the top links on on the brand new reporting dashboard for paid MonsterInsights users inside of WordPress on the Publisher Report.

  10. I’m trying to authenticate my monsterinsight but the popup at authentication doesn’t show the lower buttons (cancel and next, hence I’m stuck.

    1. Hi there,
      This is caused by a plugin conflict. If you can get in touch with us on our contact page, we’ll be happy to get you sorted out

      -Chris

  11. It seems there is no way to get a UA anymore. All new properties are automatically v4. There is no option for universal compatibility anymore?

  12. A question: does it matter if I checked Create both a v4 and a Universal Tracking id? I’m asking because it’s been more than 24 hours, and I’m still not getting any data. It’s my first time setting anything up anything like this, so I’m probably doing something silly.

  13. I did everything exactly as stated in the tutorial and it’s over 24 hours and the report isn’t showing

  14. I am setting up analytics for a new website. Do I need to install GA3 after installing GA4?

    1. Hey Chris! Thanks for your question. If it’s a new website, we’d advise to only set up GA4.

  15. This video is great,. I’ve had monsterinsights for a few years now but needed to setup GA4. I have followed your steps, however all of my previous data has now disappeared?

    1. Hi Natalie,
      Your Universal Analytics data will not be moved over into your GA4 property – to see it, you’ll have to open Google Analytics and go back into your Universal Analytics property. Google didn’t create any way of getting that old data moved over, so your GA4 property is like starting fresh without historical data.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.