How to Install Google Analytics in WordPress

Easiest Way: Monster Insights

MonsterInsights is the most popular Google Analytics plugin for WordPress. Over 3 million websites use it including the likes of Bloomberg, PlayStation, and Zillow.

As such, it’s the most simple and effective way to add Google Analytics to WordPress (for all users, beginners and experts alike).

MonsterInsights is available as both a paid premium plugin and a free version. In this tutorial, we will be using the MonsterInsights free version.

You can use the MonsterInsights Pro version if you want more advanced features like E-commerce tracking, Ads tracking, Author tracking, etc. The process of setting them up is the same.

Here’s how to set up MonsterInsights

  1. Install and activate the MonsterInsights plugin. For more details, see our step by step guide on how to install a WordPress plugin.
  2. Upon activation, click the new menu item labeled ‘Insights’ to your WordPress admin menu to open the MonsterInsights setup wizard.
  3. After the setup wizard starts, you will be asked to choose a category for your website (a business website, blog, or online store). Select one and then click on the ‘Save and Continue’ button.
  4. Click the Connect MonsterInsights button.
  5. Sign into Google Account in the popup that will open.
  6. Confirm access for MonsterInsights to access your Google Analytics account.
  7. Click on the ‘Allow’ button to continue.
  8. Select the profile you want to track. You need to select your website here.
  9. Click on the ‘Complete Connection’ button to continue.
  10. MonsterInsights will now install Google Analytics on your website. After that, you will be asked to select the recommended settings for your website.
  11. Click the Save and Continue button to save your settings.
  12. After that, you will be asked to install the WPForms plugin, which is the best WordPress contact form plugin. You can install it or simply click on ‘Skip this Step’
  13. That’s all! You have now installed and set up Google Analytics on your WordPress site. Remember, it will take Google Analytics sometime before showing your stats.

Alternative Option: Insert Headers and Footers Plugin

While this method is not as powerful as MonsterInsights because you will not be able to do advanced tracking configuration, and you will not be able to view Google Analytics data in your WordPress dashboard, it requires less memory because it doesn’t need a large plugin to do it.

How to Set Up With gtag

  1. Copy your Google Analytics tracking code (gtag.js), which you can get from the tracking information section of the settings panel.
  2. Install and activate the Insert Headers and Footers plugin. If you are using our recommended theme, Divi, you do not need to do this step.
  3. Go to the Insert Headers and Footers page under Settings and paste the Google Analytics tracking code that you copied earlier into the ‘Scripts in headers’ section.
  4. Save your changes.

How to Set Up With gtag on Divi

  1. Copy your Google Analytics tracking code (gtag.js), which you can get from the tracking information section of the settings panel.
  2. Go to Theme Options under Divi and select the Integration tab
  3. Paste the Google Analytics tracking code that you copied into the ‘Add code to the < head > of your blog’ section.
  4. Save your changes.