analytics scaled - How To Add Google Analytics to WordPress

How To Add Google Analytics to WordPress


If you’re trying to increase the traffic on your WordPress site, you can’t ignore analytics. Among other things, you will need this data to know more about your site’s visitors, which pages they frequently visit and when they visit. Thankfully, there is a free and easy to use service available that can help you out with this – Google Analytics. The service collects data from Life Cycle, Users and even Events so you can track down which ever data you need.

In this tutorial, we will show how to setup a Google Analytics account and how to integrate it with your WordPress site.

Signing Up and Configuring Google Analytics

To be able to use Google Analytics on our WordPress site you first need to sign up for a Google Account. Once that is done. Proceed to the Google Analytics dashboard.

Once there, click on the Admin link in the dashboard.

Google Analytics Dashboard

Once in the Admin page, click on Create Account button.

Create Account

Enter an Account Name.

account name

Then click on Next

click next

We then have to setup a property, which represents the WordPress site’s data. We have to give it a name. Click Next afterward

property name

Set up your business information, then click Create. Accept the Terms and Conditions after.

business information

Once that is done, you will be redirected to the Data Streams page. Click on Web to setup a web-based stream.

data streams

Enter the URL of your WordPress site in the URL text field then give it an appropriate name. Click Create Stream

set up your website stream

This will open the Web stream details window for the WordPress site. Take note of the code in the Global Site Tag. You will need to place embedded this code snippet on your WordPress site.

global site tag

Adding Google Analytics to Your WordPress Site

Using the Insert Headers and Footers Plugin

Once you’ve setup the Google Analytics account, you will be able to use Google analytics to track the data on your WordPress Site.

The easiest way to do to this is to use the Insert Headers and Footers plugin, which can be found in the Add Plugins page. Install and activate the plugin.

Install and activate the plugin

Once that is done. You just need to paste the script from the Global Site Tag in the Web stream details from your site in the Scripts in Header box in the Insert Headers and Footers page and clicking Save.

paste and save

After doing that, your WordPress site, should be tracked by Google Analytics.

Using the Google Analytics Dashboard Plugin

Another alternative is to use the Google Analytics Dashboard Plugin. Which can also be found in the Add Plugins page in the Admin Dashboard.

Google Analytics Plugin

Once, you’ve installed and activated the plugin, you’ll be redirected to the admin dashboard, and you’ll see a “Welcome to MonsterInsights” page. Scroll down and click on Launch Wizard

Click Launch Wizard

In the setup wizard, you will be asked to connect your Google Analytics account to MonsterInsights. Once you get to the page below, click on Connect MonsterInsights

Connect MonsterInsights

Allow MonsterInsight to access

MonsterInsights wants to access your Google Account

From there, proceed to the rest of the setup. When the setup is finished, your WordPress site should be tracked by Google Analytics.

Editing the header.php File

The last way, you can add Google Analytics to your WordPress Site is through modifying header.php file of your theme. This can be edited through the Theme Editor page in the WordPress Admin dashboard.

To do edit the header.php file look for the Theme Functions link on the right hand sidebar of the Theme Editor page.

edit themes

Place the code found in your Global Site Tag inside the <head> tag of the header.php file. Click on Update File after.

place the code

After doing this, Google Analytics should now be tracking your website.


That’s the end our tutorial. We’ve learned how to setup Google Analytics and integrate it with a WordPress site.


Leave a Reply

Your email address will not be published. Required fields are marked *