If you run a website then having the data on how many visitors your website is receiving or where they are coming from is necessary. Google Analytics is one such free service that allows you to know and understand your visitors.
Table of Contents
Installing Google Analytics in WordPress
Integrating Google Analytics on your WordPress website can be done in many ways. We are going to cover the best methods below.
Pre-requisites
You will first need to signup with Google Analytics. You can visit this link to signup. After signing up, adding your website is pretty straightforward. Just fill in the details related to your website.
Installing Google Analytics by adding the code in your theme file
The best way to add Google analytics tracking code on your website is to insert the code in the header.php file. This allows Google to track every page that is loaded on your website.
Edit your header.php file and paste the tracking code from the Google Analytics website just below the <body> tag. Save the file and Google analytics should now be integrated on your website.
Installing Google Analytics using a plugin
There are many plugins for installing Google Analytics on your website. We will be using the Google Analytics Dashboard Plugin for WordPress by MonsterInsights.
Steps to install Google Analytics using the plugin:
- Install and activate the plugin.
- You will find a new menu item called Insights in your admin dashboard. Click it.
- A setup wizard will now open.
- Select the appropriate category and click on the Save and Continue button.
- Now click the Connect MonsterInsights button.
- You will now need to sign in to your Google account through which you created the Google analytics account.
- You will now be presented with a list of permissions that MonsterInsights is requesting. Click on the Allow button.
- Select your website from the drop down menu and click on the Complete Connection button. Google Analytics is now integrated on your website.
- The default settings should take care of everything but if you want to configure the settings you can do it and click on the Save and Continue button.
- You can click on the Skip button for the next steps.
- In the end you will be presented with a Finish Setup & Exit Wizard button, click on it.
MonsterInsights also allows you to view your reports from within your admin dashboard. Simply visit Insights -> Reports from your admin dashboard.
Final Thoughts
Google Analytics is a very important tool that anyone running a website should use. It helps give you valuable information regarding your visitors behavior, where they are coming from, how long they are staying on your website and many more things.