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
- Install and activate the MonsterInsights plugin. For more details, see our step by step guide on how to install a WordPress plugin.
- Upon activation, click the new menu item labeled ‘Insights’ to your WordPress admin menu to open the MonsterInsights setup wizard.
- 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.
- Click the Connect MonsterInsights button.
- Sign into Google Account in the popup that will open.
- Confirm access for MonsterInsights to access your Google Analytics account.
- Click on the ‘Allow’ button to continue.
- Select the profile you want to track. You need to select your website here.
- Click on the ‘Complete Connection’ button to continue.
- MonsterInsights will now install Google Analytics on your website. After that, you will be asked to select the recommended settings for your website.
- Click the Save and Continue button to save your settings.
- 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’
- 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
- Copy your Google Analytics tracking code (gtag.js), which you can get from the tracking information section of the settings panel.
- 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.
- 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.
- Save your changes.
How to Set Up With gtag on Divi
- Copy your Google Analytics tracking code (gtag.js), which you can get from the tracking information section of the settings panel.
- Go to Theme Options under Divi and select the Integration tab
- Paste the Google Analytics tracking code that you copied into the ‘Add code to the < head > of your blog’ section.
- Save your changes.